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

// CheckDriveMemberPermissionOld 该接口用于根据 filetoken 判断当前登录用户是否具有某权限。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uYzN3UjL2czN14iN3cTN
// new doc: https://open.feishu.cn/document/server-docs/historic-version/docs/drive/permission/querying-if-a-collaborator-has-a-specific-permission
//
// Deprecated
func (r *DriveService) CheckDriveMemberPermissionOld(ctx context.Context, request *CheckDriveMemberPermissionOldReq, options ...MethodOptionFunc) (*CheckDriveMemberPermissionOldResp, *Response, error) {
	if r.cli.mock.mockDriveCheckDriveMemberPermissionOld != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#CheckDriveMemberPermissionOld mock enable")
		return r.cli.mock.mockDriveCheckDriveMemberPermissionOld(ctx, request, options...)
	}

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

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

// MockDriveCheckDriveMemberPermissionOld mock DriveCheckDriveMemberPermissionOld method
func (r *Mock) MockDriveCheckDriveMemberPermissionOld(f func(ctx context.Context, request *CheckDriveMemberPermissionOldReq, options ...MethodOptionFunc) (*CheckDriveMemberPermissionOldResp, *Response, error)) {
	r.mockDriveCheckDriveMemberPermissionOld = f
}

// UnMockDriveCheckDriveMemberPermissionOld un-mock DriveCheckDriveMemberPermissionOld method
func (r *Mock) UnMockDriveCheckDriveMemberPermissionOld() {
	r.mockDriveCheckDriveMemberPermissionOld = nil
}

// CheckDriveMemberPermissionOldReq ...
type CheckDriveMemberPermissionOldReq 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
	Perm  string `json:"perm,omitempty"`  // 权限, "view" or "edit" or "share"
}

// CheckDriveMemberPermissionOldResp ...
type CheckDriveMemberPermissionOldResp struct {
	IsPermitted bool `json:"is_permitted,omitempty"` // 是否具有指定权限
}

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