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

// DownloadVCExportFile 下载导出文件。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/vc-v1/export/download
// new doc: https://open.feishu.cn/document/server-docs/vc-v1/export/download
func (r *VCService) DownloadVCExportFile(ctx context.Context, request *DownloadVCExportFileReq, options ...MethodOptionFunc) (*DownloadVCExportFileResp, *Response, error) {
	if r.cli.mock.mockVCDownloadVCExportFile != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] VC#DownloadVCExportFile mock enable")
		return r.cli.mock.mockVCDownloadVCExportFile(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "VC",
		API:                   "DownloadVCExportFile",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/vc/v1/exports/download",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(downloadVCExportFileResp)

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

// MockVCDownloadVCExportFile mock VCDownloadVCExportFile method
func (r *Mock) MockVCDownloadVCExportFile(f func(ctx context.Context, request *DownloadVCExportFileReq, options ...MethodOptionFunc) (*DownloadVCExportFileResp, *Response, error)) {
	r.mockVCDownloadVCExportFile = f
}

// UnMockVCDownloadVCExportFile un-mock VCDownloadVCExportFile method
func (r *Mock) UnMockVCDownloadVCExportFile() {
	r.mockVCDownloadVCExportFile = nil
}

// DownloadVCExportFileReq ...
type DownloadVCExportFileReq struct {
	FileToken string `query:"file_token" json:"-"` // 文档token, 示例值: 6yHu7Igp7Igy62Ez6fLr6IJz7j9i5WMe6fHq5yZeY2Jz6yLqYAMAY46fZfEz64Lr5fYyYQ==
}

// downloadVCExportFileResp ...
type downloadVCExportFileResp struct {
	Code  int64                     `json:"code,omitempty"`
	Msg   string                    `json:"msg,omitempty"`
	Data  *DownloadVCExportFileResp `json:"data,omitempty"`
	Error *ErrorDetail              `json:"error,omitempty"`
}

func (r *downloadVCExportFileResp) SetReader(file io.Reader) {
	if r.Data == nil {
		r.Data = &DownloadVCExportFileResp{}
	}
	r.Data.File = file
}

// DownloadVCExportFileResp ...
type DownloadVCExportFileResp struct {
	File io.Reader `json:"file,omitempty"`
}
