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

// UpdateSheetProperty 该接口用于根据 spreadsheetToken 更新表格属性, 如更新表格标题。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ucTMzUjL3EzM14yNxMTN
// new doc: https://open.feishu.cn/document/server-docs/historic-version/docs/sheets/update-spreadsheet-properties
//
// Deprecated
func (r *DriveService) UpdateSheetProperty(ctx context.Context, request *UpdateSheetPropertyReq, options ...MethodOptionFunc) (*UpdateSheetPropertyResp, *Response, error) {
	if r.cli.mock.mockDriveUpdateSheetProperty != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#UpdateSheetProperty mock enable")
		return r.cli.mock.mockDriveUpdateSheetProperty(ctx, request, options...)
	}

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

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

// MockDriveUpdateSheetProperty mock DriveUpdateSheetProperty method
func (r *Mock) MockDriveUpdateSheetProperty(f func(ctx context.Context, request *UpdateSheetPropertyReq, options ...MethodOptionFunc) (*UpdateSheetPropertyResp, *Response, error)) {
	r.mockDriveUpdateSheetProperty = f
}

// UnMockDriveUpdateSheetProperty un-mock DriveUpdateSheetProperty method
func (r *Mock) UnMockDriveUpdateSheetProperty() {
	r.mockDriveUpdateSheetProperty = nil
}

// UpdateSheetPropertyReq ...
type UpdateSheetPropertyReq struct {
	SpreadSheetToken string                            `path:"spreadsheetToken" json:"-"` // spreadsheet 的 token, 获取方式见[在线表格开发指南](https://open.feishu.cn/document/ukTMukTMukTM/uATMzUjLwEzM14CMxMTN/overview)
	Properties       *UpdateSheetPropertyReqProperties `json:"properties,omitempty"`      // spreadsheet 的属性
}

// UpdateSheetPropertyReqProperties ...
type UpdateSheetPropertyReqProperties struct {
	Title string `json:"title,omitempty"` // spreadsheet 的标题, 最大长度100个字符
}

// UpdateSheetPropertyResp ...
type UpdateSheetPropertyResp struct {
	SpreadSheetToken string `json:"spreadsheetToken,omitempty"` // spreadsheet 的 token
	Title            string `json:"title,omitempty"`            // spreadsheet 的标题
}

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