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

// UpdateWikiNodeTitle 此接口用于更新节点标题
//
// 此接口目前仅支持文档(doc)、新版文档(docx)和快捷方式。
//
// doc: https://open.feishu.cn/document/ukTMukTMukTM/uUDN04SN0QjL1QDN/wiki-v2/space-node/update_title
// new doc: https://open.feishu.cn/document/server-docs/docs/wiki-v2/space-node/update_title
func (r *DriveService) UpdateWikiNodeTitle(ctx context.Context, request *UpdateWikiNodeTitleReq, options ...MethodOptionFunc) (*UpdateWikiNodeTitleResp, *Response, error) {
	if r.cli.mock.mockDriveUpdateWikiNodeTitle != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Drive#UpdateWikiNodeTitle mock enable")
		return r.cli.mock.mockDriveUpdateWikiNodeTitle(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Drive",
		API:                   "UpdateWikiNodeTitle",
		Method:                "POST",
		URL:                   r.cli.openBaseURL + "/open-apis/wiki/v2/spaces/:space_id/nodes/:node_token/update_title",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(updateWikiNodeTitleResp)

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

// MockDriveUpdateWikiNodeTitle mock DriveUpdateWikiNodeTitle method
func (r *Mock) MockDriveUpdateWikiNodeTitle(f func(ctx context.Context, request *UpdateWikiNodeTitleReq, options ...MethodOptionFunc) (*UpdateWikiNodeTitleResp, *Response, error)) {
	r.mockDriveUpdateWikiNodeTitle = f
}

// UnMockDriveUpdateWikiNodeTitle un-mock DriveUpdateWikiNodeTitle method
func (r *Mock) UnMockDriveUpdateWikiNodeTitle() {
	r.mockDriveUpdateWikiNodeTitle = nil
}

// UpdateWikiNodeTitleReq ...
type UpdateWikiNodeTitleReq struct {
	SpaceID   string `path:"space_id" json:"-"`   // 知识空间ID, 示例值: "6946843325487912356"
	NodeToken string `path:"node_token" json:"-"` // 节点token, 示例值: "wikcnKQ1k3pcuo5uSK4t8Vabcef"
	Title     string `json:"title,omitempty"`     // 节点新标题, 示例值: "新标题"
}

// UpdateWikiNodeTitleResp ...
type UpdateWikiNodeTitleResp struct {
}

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