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

// DeleteSheetDimensionRange 该接口用于根据 spreadsheetToken 和维度信息删除行/列 。单次删除最大5000行/列。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ucjMzUjL3IzM14yNyMTN
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/sheet-rowcol/-delete-rows-or-columns
func (r *DriveService) DeleteSheetDimensionRange(ctx context.Context, request *DeleteSheetDimensionRangeReq, options ...MethodOptionFunc) (*DeleteSheetDimensionRangeResp, *Response, error) {
	if r.cli.mock.mockDriveDeleteSheetDimensionRange != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#DeleteSheetDimensionRange mock enable")
		return r.cli.mock.mockDriveDeleteSheetDimensionRange(ctx, request, options...)
	}

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

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

// MockDriveDeleteSheetDimensionRange mock DriveDeleteSheetDimensionRange method
func (r *Mock) MockDriveDeleteSheetDimensionRange(f func(ctx context.Context, request *DeleteSheetDimensionRangeReq, options ...MethodOptionFunc) (*DeleteSheetDimensionRangeResp, *Response, error)) {
	r.mockDriveDeleteSheetDimensionRange = f
}

// UnMockDriveDeleteSheetDimensionRange un-mock DriveDeleteSheetDimensionRange method
func (r *Mock) UnMockDriveDeleteSheetDimensionRange() {
	r.mockDriveDeleteSheetDimensionRange = nil
}

// DeleteSheetDimensionRangeReq ...
type DeleteSheetDimensionRangeReq struct {
	SpreadSheetToken string                                 `path:"spreadsheetToken" json:"-"` // spreadsheet的token, 详见 [在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	Dimension        *DeleteSheetDimensionRangeReqDimension `json:"dimension,omitempty"`       // 需要删除行列的维度信息, 将删除[startIndex, endIndex]区间的行或列
}

// DeleteSheetDimensionRangeReqDimension ...
type DeleteSheetDimensionRangeReqDimension struct {
	SheetID        string `json:"sheetId,omitempty"`        // sheetId
	MajorDimension string `json:"majorDimension,omitempty"` // 可选 ROWS、COLUMNS
	StartIndex     int64  `json:"startIndex"`               // 开始的位置, 从1开始
	EndIndex       int64  `json:"endIndex,omitempty"`       // 结束的位置
}

// DeleteSheetDimensionRangeResp ...
type DeleteSheetDimensionRangeResp struct {
	DelCount       int64  `json:"delCount,omitempty"`       // 删除的行/列数
	MajorDimension string `json:"majorDimension,omitempty"` // 插入维度
}

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