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

// PrependSheetValue 根据 [SpreadsheetToken](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview#6d80ef81) 在其特定工作表的指定范围的开始位置上方增加若干行, 并填充相应的数据。这里的工作表和范围是通过接口请求体中的`range`属性来确定的, 例如:
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uIjMzUjLyIzM14iMyMTN
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/data-operation/prepend-data
func (r *DriveService) PrependSheetValue(ctx context.Context, request *PrependSheetValueReq, options ...MethodOptionFunc) (*PrependSheetValueResp, *Response, error) {
	if r.cli.mock.mockDrivePrependSheetValue != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#PrependSheetValue mock enable")
		return r.cli.mock.mockDrivePrependSheetValue(ctx, request, options...)
	}

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

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

// MockDrivePrependSheetValue mock DrivePrependSheetValue method
func (r *Mock) MockDrivePrependSheetValue(f func(ctx context.Context, request *PrependSheetValueReq, options ...MethodOptionFunc) (*PrependSheetValueResp, *Response, error)) {
	r.mockDrivePrependSheetValue = f
}

// UnMockDrivePrependSheetValue un-mock DrivePrependSheetValue method
func (r *Mock) UnMockDrivePrependSheetValue() {
	r.mockDrivePrependSheetValue = nil
}

// PrependSheetValueReq ...
type PrependSheetValueReq struct {
	SpreadSheetToken string                          `path:"spreadsheetToken" json:"-"` // sheet的token, 获取方式见 [在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	ValueRange       *PrependSheetValueReqValueRange `json:"valueRange,omitempty"`      // 值与范围
}

// PrependSheetValueReqValueRange ...
type PrependSheetValueReqValueRange struct {
	Range  string           `json:"range,omitempty"`  // ⁣插入范围, 包含 sheetId 与单元格范围两部分, 目前支持四种索引方式, 详见 [在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview), range所表示的范围需要大于等于values占用的范围。
	Values [][]SheetContent `json:"values,omitempty"` // 需要写入的值, 如要写入公式、超链接、email、@人等, 可详看附录[sheet 支持写入数据类型](https://open.feishu.cn/document/ukTMukTMukTM/ugjN1UjL4YTN14CO2UTN)
}

// PrependSheetValueResp ...
type PrependSheetValueResp struct {
	SpreadSheetToken string                        `json:"spreadsheetToken,omitempty"` // spreadsheet 的 token
	TableRange       string                        `json:"tableRange,omitempty"`       // 写入的范围
	Revision         int64                         `json:"revision,omitempty"`         // sheet 的版本号
	Updates          *PrependSheetValueRespUpdates `json:"updates,omitempty"`          // 插入数据的范围、行列数等
}

// PrependSheetValueRespUpdates ...
type PrependSheetValueRespUpdates struct {
	SpreadSheetToken string `json:"spreadsheetToken,omitempty"` // spreadsheet 的 token
	UpdatedRange     string `json:"updatedRange,omitempty"`     // 写入的范围
	UpdatedRows      int64  `json:"updatedRows,omitempty"`      // 写入的行数
	UpdatedColumns   int64  `json:"updatedColumns,omitempty"`   // 写入的列数
	UpdatedCells     int64  `json:"updatedCells,omitempty"`     // 写入的单元格总数
	Revision         int64  `json:"revision,omitempty"`         // sheet 的版本号
}

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