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

// GetHelpdeskFAQImage 该接口用于获取知识库图像。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/faq/faq_image
// new doc: https://open.feishu.cn/document/server-docs/helpdesk-v1/faq-management/faq/faq_image
func (r *HelpdeskService) GetHelpdeskFAQImage(ctx context.Context, request *GetHelpdeskFAQImageReq, options ...MethodOptionFunc) (*GetHelpdeskFAQImageResp, *Response, error) {
	if r.cli.mock.mockHelpdeskGetHelpdeskFAQImage != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Helpdesk#GetHelpdeskFAQImage mock enable")
		return r.cli.mock.mockHelpdeskGetHelpdeskFAQImage(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Helpdesk",
		API:                   "GetHelpdeskFAQImage",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/helpdesk/v1/faqs/:id/image/:image_key",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedHelpdeskAuth:      true,
	}
	resp := new(getHelpdeskFAQImageResp)

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

// MockHelpdeskGetHelpdeskFAQImage mock HelpdeskGetHelpdeskFAQImage method
func (r *Mock) MockHelpdeskGetHelpdeskFAQImage(f func(ctx context.Context, request *GetHelpdeskFAQImageReq, options ...MethodOptionFunc) (*GetHelpdeskFAQImageResp, *Response, error)) {
	r.mockHelpdeskGetHelpdeskFAQImage = f
}

// UnMockHelpdeskGetHelpdeskFAQImage un-mock HelpdeskGetHelpdeskFAQImage method
func (r *Mock) UnMockHelpdeskGetHelpdeskFAQImage() {
	r.mockHelpdeskGetHelpdeskFAQImage = nil
}

// GetHelpdeskFAQImageReq ...
type GetHelpdeskFAQImageReq struct {
	ID       string `path:"id" json:"-"`        // 知识库ID, 示例值: "12345"
	ImageKey string `path:"image_key" json:"-"` // 图像key, 示例值: "img_b07ffac0-19c1-48a3-afca-599f8ea825fj"
}

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

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

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