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

// QuerySheetFloatImage 返回子表内所有的浮动图片信息。
//
// 浮动图片参考: [浮动图片指南](https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet-float_image/float-image-user-guide)
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/sheets-v3/spreadsheet-sheet-float_image/query
// new doc: https://open.feishu.cn/document/server-docs/docs/sheets-v3/spreadsheet-sheet-float_image/query
func (r *DriveService) QuerySheetFloatImage(ctx context.Context, request *QuerySheetFloatImageReq, options ...MethodOptionFunc) (*QuerySheetFloatImageResp, *Response, error) {
	if r.cli.mock.mockDriveQuerySheetFloatImage != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#QuerySheetFloatImage mock enable")
		return r.cli.mock.mockDriveQuerySheetFloatImage(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "QuerySheetFloatImage",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/sheets/v3/spreadsheets/:spreadsheet_token/sheets/:sheet_id/float_images/query",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(querySheetFloatImageResp)

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

// MockDriveQuerySheetFloatImage mock DriveQuerySheetFloatImage method
func (r *Mock) MockDriveQuerySheetFloatImage(f func(ctx context.Context, request *QuerySheetFloatImageReq, options ...MethodOptionFunc) (*QuerySheetFloatImageResp, *Response, error)) {
	r.mockDriveQuerySheetFloatImage = f
}

// UnMockDriveQuerySheetFloatImage un-mock DriveQuerySheetFloatImage method
func (r *Mock) UnMockDriveQuerySheetFloatImage() {
	r.mockDriveQuerySheetFloatImage = nil
}

// QuerySheetFloatImageReq ...
type QuerySheetFloatImageReq struct {
	SpreadSheetToken string `path:"spreadsheet_token" json:"-"` // 表格 token, 示例值: "shtcnmBA*yGehy8"
	SheetID          string `path:"sheet_id" json:"-"`          // 子表 id, 示例值: "0b**12"
}

// QuerySheetFloatImageResp ...
type QuerySheetFloatImageResp struct {
	Items []*QuerySheetFloatImageRespItem `json:"items,omitempty"` // 子表的所有浮动图片信息
}

// QuerySheetFloatImageRespItem ...
type QuerySheetFloatImageRespItem struct {
	FloatImageID    string  `json:"float_image_id,omitempty"`    // 浮动图片 id
	FloatImageToken string  `json:"float_image_token,omitempty"` // [更新时不用传, 创建需要]浮动图片 token, 需要先上传图片到表格获得此 token 之后再进行浮动图片的相关操作
	Range           string  `json:"range,omitempty"`             // 浮动图片的左上角单元格定位, 只支持一个单元格
	Width           float64 `json:"width,omitempty"`             // 浮动图片的宽度, 大于等于 20px
	Height          float64 `json:"height,omitempty"`            // 浮动图片的高度, 大于等于 20px
	OffsetX         float64 `json:"offset_x,omitempty"`          // 浮动图片左上角所在位置相对于所在单元格左上角的横向偏移, 大于等于0且小于所在单元格的宽度
	OffsetY         float64 `json:"offset_y,omitempty"`          // 浮动图片左上角所在位置相对于所在单元格左上角的纵向偏移, 大于等于0且小于所在单元格的高度
}

// querySheetFloatImageResp ...
type querySheetFloatImageResp struct {
	Code  int64                     `json:"code,omitempty"` // 错误码, 非 0 表示失败
	Msg   string                    `json:"msg,omitempty"`  // 错误描述
	Data  *QuerySheetFloatImageResp `json:"data,omitempty"`
	Error *ErrorDetail              `json:"error,omitempty"`
}
