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

// DeleteTaskAttachment 提供一个附件GUID, 删除该附件。删除后该附件不可再恢复。
//
// 删除附件需要调用身份拥有被删除附件所属资源的的编辑权限, 或者调用身份就是附件的上传人。
//
// doc: https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/task-v2/attachment/delete
func (r *TaskService) DeleteTaskAttachment(ctx context.Context, request *DeleteTaskAttachmentReq, options ...MethodOptionFunc) (*DeleteTaskAttachmentResp, *Response, error) {
	if r.cli.mock.mockTaskDeleteTaskAttachment != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Task#DeleteTaskAttachment mock enable")
		return r.cli.mock.mockTaskDeleteTaskAttachment(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Task",
		API:                   "DeleteTaskAttachment",
		Method:                "DELETE",
		URL:                   r.cli.openBaseURL + "/open-apis/task/v2/attachments/:attachment_guid",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(deleteTaskAttachmentResp)

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

// MockTaskDeleteTaskAttachment mock TaskDeleteTaskAttachment method
func (r *Mock) MockTaskDeleteTaskAttachment(f func(ctx context.Context, request *DeleteTaskAttachmentReq, options ...MethodOptionFunc) (*DeleteTaskAttachmentResp, *Response, error)) {
	r.mockTaskDeleteTaskAttachment = f
}

// UnMockTaskDeleteTaskAttachment un-mock TaskDeleteTaskAttachment method
func (r *Mock) UnMockTaskDeleteTaskAttachment() {
	r.mockTaskDeleteTaskAttachment = nil
}

// DeleteTaskAttachmentReq ...
type DeleteTaskAttachmentReq struct {
	AttachmentGuid string `path:"attachment_guid" json:"-"` // 要删除附件的GUID。可以通过创建[上传附件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/task-v2/attachment/upload)接口创建, 或者通过[列取附件](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/task-v2/attachment/list)接口查询得到, 示例值: "b59aa7a3-e98c-4830-8273-cbb29f89b837", 最大长度: `100` 字符
}

// DeleteTaskAttachmentResp ...
type DeleteTaskAttachmentResp struct {
}

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