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

// GetBitableMeta 获取指定多维表格的元数据信息, 包括多维表格名称, 多维表格版本号, 多维表格是否开启高级权限等。
//
// ::: note
// 首次调用请参考 [云文档接口快速入门](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)[多维表格接口接入指南](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification)
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app/get
// new doc: https://open.feishu.cn/document/server-docs/docs/bitable-v1/app/get
func (r *BitableService) GetBitableMeta(ctx context.Context, request *GetBitableMetaReq, options ...MethodOptionFunc) (*GetBitableMetaResp, *Response, error) {
	if r.cli.mock.mockBitableGetBitableMeta != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Bitable#GetBitableMeta mock enable")
		return r.cli.mock.mockBitableGetBitableMeta(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Bitable",
		API:                   "GetBitableMeta",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/bitable/v1/apps/:app_token",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getBitableMetaResp)

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

// MockBitableGetBitableMeta mock BitableGetBitableMeta method
func (r *Mock) MockBitableGetBitableMeta(f func(ctx context.Context, request *GetBitableMetaReq, options ...MethodOptionFunc) (*GetBitableMetaResp, *Response, error)) {
	r.mockBitableGetBitableMeta = f
}

// UnMockBitableGetBitableMeta un-mock BitableGetBitableMeta method
func (r *Mock) UnMockBitableGetBitableMeta() {
	r.mockBitableGetBitableMeta = nil
}

// GetBitableMetaReq ...
type GetBitableMetaReq struct {
	AppToken string `path:"app_token" json:"-"` // 多维表格的唯一标识符 [app_token 参数说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification#8121eebe), 示例值: "appbcbWCzen6D8dezhoCH2RpMAh"
}

// GetBitableMetaResp ...
type GetBitableMetaResp struct {
	App *GetBitableMetaRespApp `json:"app,omitempty"` // 多维表格元数据
}

// GetBitableMetaRespApp ...
type GetBitableMetaRespApp struct {
	AppToken   string `json:"app_token,omitempty"`   // 多维表格的 app_token, [app_token 参数说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification#8121eebe)
	Name       string `json:"name,omitempty"`        // 多维表格的名字
	Revision   int64  `json:"revision,omitempty"`    // 多维表格的版本号（对多维表格进行修改时更新, 如新增、删除数据表, 修改数据表名等, 初始为1, 每次更新+1）
	IsAdvanced bool   `json:"is_advanced,omitempty"` // 多维表格是否开启了高级权限。取值包括: true: 表示开启了高级权限, false: 表示关闭了高级权限, [了解更多: 使用多维表格高级权限](https://www.feishu.cn/hc/zh-CN/articles/588604550568)
	TimeZone   string `json:"time_zone,omitempty"`   // 文档时区
}

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