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

// UpdateHelpdeskCategory 该接口用于更新知识库分类详情。
//
// 注意事项:
// user_access_token 访问, 需要操作者是当前服务台的客服、管理员或所有者
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/category/patch
// new doc: https://open.feishu.cn/document/server-docs/helpdesk-v1/faq-management/category/patch
func (r *HelpdeskService) UpdateHelpdeskCategory(ctx context.Context, request *UpdateHelpdeskCategoryReq, options ...MethodOptionFunc) (*UpdateHelpdeskCategoryResp, *Response, error) {
	if r.cli.mock.mockHelpdeskUpdateHelpdeskCategory != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Helpdesk#UpdateHelpdeskCategory mock enable")
		return r.cli.mock.mockHelpdeskUpdateHelpdeskCategory(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:               "Helpdesk",
		API:                 "UpdateHelpdeskCategory",
		Method:              "PATCH",
		URL:                 r.cli.openBaseURL + "/open-apis/helpdesk/v1/categories/:id",
		Body:                request,
		MethodOption:        newMethodOption(options),
		NeedUserAccessToken: true,
		NeedHelpdeskAuth:    true,
	}
	resp := new(updateHelpdeskCategoryResp)

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

// MockHelpdeskUpdateHelpdeskCategory mock HelpdeskUpdateHelpdeskCategory method
func (r *Mock) MockHelpdeskUpdateHelpdeskCategory(f func(ctx context.Context, request *UpdateHelpdeskCategoryReq, options ...MethodOptionFunc) (*UpdateHelpdeskCategoryResp, *Response, error)) {
	r.mockHelpdeskUpdateHelpdeskCategory = f
}

// UnMockHelpdeskUpdateHelpdeskCategory un-mock HelpdeskUpdateHelpdeskCategory method
func (r *Mock) UnMockHelpdeskUpdateHelpdeskCategory() {
	r.mockHelpdeskUpdateHelpdeskCategory = nil
}

// UpdateHelpdeskCategoryReq ...
type UpdateHelpdeskCategoryReq struct {
	ID       string  `path:"id" json:"-"`         // category id, 示例值: "6948728206392295444"
	Name     *string `json:"name,omitempty"`      // 名称, 示例值: "创建团队和邀请成员"
	ParentID *string `json:"parent_id,omitempty"` // 父知识库分类ID, 示例值: "0"
}

// UpdateHelpdeskCategoryResp ...
type UpdateHelpdeskCategoryResp struct {
}

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