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

// GetDriveRootFolderMeta 该接口用于获取用户“我的空间”（root folder）的元数据, 包括文件夹的 token、ID 和文件夹所有者的 ID。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/ugTNzUjL4UzM14CO1MTN/get-root-folder-meta
// new doc: https://open.feishu.cn/document/server-docs/docs/drive-v1/folder/get-root-folder-meta
func (r *DriveService) GetDriveRootFolderMeta(ctx context.Context, request *GetDriveRootFolderMetaReq, options ...MethodOptionFunc) (*GetDriveRootFolderMetaResp, *Response, error) {
	if r.cli.mock.mockDriveGetDriveRootFolderMeta != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#GetDriveRootFolderMeta mock enable")
		return r.cli.mock.mockDriveGetDriveRootFolderMeta(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "GetDriveRootFolderMeta",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/drive/explorer/v2/root_folder/meta",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getDriveRootFolderMetaResp)

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

// MockDriveGetDriveRootFolderMeta mock DriveGetDriveRootFolderMeta method
func (r *Mock) MockDriveGetDriveRootFolderMeta(f func(ctx context.Context, request *GetDriveRootFolderMetaReq, options ...MethodOptionFunc) (*GetDriveRootFolderMetaResp, *Response, error)) {
	r.mockDriveGetDriveRootFolderMeta = f
}

// UnMockDriveGetDriveRootFolderMeta un-mock DriveGetDriveRootFolderMeta method
func (r *Mock) UnMockDriveGetDriveRootFolderMeta() {
	r.mockDriveGetDriveRootFolderMeta = nil
}

// GetDriveRootFolderMetaReq ...
type GetDriveRootFolderMetaReq struct {
}

// GetDriveRootFolderMetaResp ...
type GetDriveRootFolderMetaResp struct {
	Token  string `json:"token,omitempty"`   // 文件夹的 token
	ID     string `json:"id,omitempty"`      // 文件夹的 ID
	UserID string `json:"user_id,omitempty"` // 文件夹所有者的 ID
}

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