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

// TransferDriveMemberPermission 该接口用于根据文档信息和用户信息转移文档的所有者。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uQzNzUjL0czM14CN3MTN
// new doc: https://open.feishu.cn/document/server-docs/historic-version/docs/drive/permission/transfer-ownership
//
// Deprecated
func (r *DriveService) TransferDriveMemberPermission(ctx context.Context, request *TransferDriveMemberPermissionReq, options ...MethodOptionFunc) (*TransferDriveMemberPermissionResp, *Response, error) {
	if r.cli.mock.mockDriveTransferDriveMemberPermission != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#TransferDriveMemberPermission mock enable")
		return r.cli.mock.mockDriveTransferDriveMemberPermission(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "TransferDriveMemberPermission",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/drive/permission/member/transfer",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(transferDriveMemberPermissionResp)

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

// MockDriveTransferDriveMemberPermission mock DriveTransferDriveMemberPermission method
func (r *Mock) MockDriveTransferDriveMemberPermission(f func(ctx context.Context, request *TransferDriveMemberPermissionReq, options ...MethodOptionFunc) (*TransferDriveMemberPermissionResp, *Response, error)) {
	r.mockDriveTransferDriveMemberPermission = f
}

// UnMockDriveTransferDriveMemberPermission un-mock DriveTransferDriveMemberPermission method
func (r *Mock) UnMockDriveTransferDriveMemberPermission() {
	r.mockDriveTransferDriveMemberPermission = nil
}

// TransferDriveMemberPermissionReq ...
type TransferDriveMemberPermissionReq struct {
	Token          string                                 `json:"token,omitempty"`            // 文件的 token, 获取方式见 [如何获取云文档资源相关 token](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN#08bb5df6)
	Type           string                                 `json:"type,omitempty"`             // 文档类型, 可选 doc、docx、sheet、bitable、file
	Owner          *TransferDriveMemberPermissionReqOwner `json:"owner,omitempty"`            // 要转移到的新的文档所有者
	RemoveOldOwner *bool                                  `json:"remove_old_owner,omitempty"` // true 为转移后删除旧 owner 的权限, 默认为false
	CancelNotify   *bool                                  `json:"cancel_notify,omitempty"`    // true为不通知新owner, 默认为false
}

// TransferDriveMemberPermissionReqOwner ...
type TransferDriveMemberPermissionReqOwner struct {
	MemberType string `json:"member_type,omitempty"` // 用户类型, 可选 email、openid、userid、unionid
	MemberID   string `json:"member_id,omitempty"`   // 用户类型下的值, 获取方式见 [如何获取不同的用户 ID](https://open.feishu.cn/document/home/user-identity-introduction/open-id)
}

// TransferDriveMemberPermissionResp ...
type TransferDriveMemberPermissionResp struct {
	IsSuccess bool                                    `json:"is_success,omitempty"` // 请求是否成功
	Type      string                                  `json:"type,omitempty"`       // 文档类型, 可选 doc、sheet、bitable、file
	Token     string                                  `json:"token,omitempty"`      // 文档的 token
	Owner     *TransferDriveMemberPermissionRespOwner `json:"owner,omitempty"`      // 文档当前所有者
}

// TransferDriveMemberPermissionRespOwner ...
type TransferDriveMemberPermissionRespOwner struct {
	MemberType string `json:"member_type,omitempty"` // 用户类型, 有 email、openid、userid、unionid
	MemberID   string `json:"member_id,omitempty"`   // 用户类型下的值
}

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