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

// GetHireAttachmentPreview 根据人才简历附件 ID 获取附件预览信息, 可通过[获取人才信息](https://open.feishu.cn/document/server-docs/hire-v1/candidate-management/talent/get-2)接口获取人才的简历附件
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uMzM1YjLzMTN24yMzUjN/hire-v1/attachment/preview
// new doc: https://open.feishu.cn/document/server-docs/hire-v1/attachment/preview
func (r *HireService) GetHireAttachmentPreview(ctx context.Context, request *GetHireAttachmentPreviewReq, options ...MethodOptionFunc) (*GetHireAttachmentPreviewResp, *Response, error) {
	if r.cli.mock.mockHireGetHireAttachmentPreview != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Hire#GetHireAttachmentPreview mock enable")
		return r.cli.mock.mockHireGetHireAttachmentPreview(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Hire",
		API:                   "GetHireAttachmentPreview",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/hire/v1/attachments/:attachment_id/preview",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(getHireAttachmentPreviewResp)

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

// MockHireGetHireAttachmentPreview mock HireGetHireAttachmentPreview method
func (r *Mock) MockHireGetHireAttachmentPreview(f func(ctx context.Context, request *GetHireAttachmentPreviewReq, options ...MethodOptionFunc) (*GetHireAttachmentPreviewResp, *Response, error)) {
	r.mockHireGetHireAttachmentPreview = f
}

// UnMockHireGetHireAttachmentPreview un-mock HireGetHireAttachmentPreview method
func (r *Mock) UnMockHireGetHireAttachmentPreview() {
	r.mockHireGetHireAttachmentPreview = nil
}

// GetHireAttachmentPreviewReq ...
type GetHireAttachmentPreviewReq struct {
	AttachmentID string `path:"attachment_id" json:"-"` // 附件id, 示例值: "11111"
}

// GetHireAttachmentPreviewResp ...
type GetHireAttachmentPreviewResp struct {
	URL string `json:"url,omitempty"` // 预览链接
}

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