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

// GetHelpdeskCategoryList 该接口用于获取服务台知识库所有分类。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/category/list-categories
// new doc: https://open.feishu.cn/document/server-docs/helpdesk-v1/faq-management/category/list-categories
func (r *HelpdeskService) GetHelpdeskCategoryList(ctx context.Context, request *GetHelpdeskCategoryListReq, options ...MethodOptionFunc) (*GetHelpdeskCategoryListResp, *Response, error) {
	if r.cli.mock.mockHelpdeskGetHelpdeskCategoryList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Helpdesk#GetHelpdeskCategoryList mock enable")
		return r.cli.mock.mockHelpdeskGetHelpdeskCategoryList(ctx, request, options...)
	}

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

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

// MockHelpdeskGetHelpdeskCategoryList mock HelpdeskGetHelpdeskCategoryList method
func (r *Mock) MockHelpdeskGetHelpdeskCategoryList(f func(ctx context.Context, request *GetHelpdeskCategoryListReq, options ...MethodOptionFunc) (*GetHelpdeskCategoryListResp, *Response, error)) {
	r.mockHelpdeskGetHelpdeskCategoryList = f
}

// UnMockHelpdeskGetHelpdeskCategoryList un-mock HelpdeskGetHelpdeskCategoryList method
func (r *Mock) UnMockHelpdeskGetHelpdeskCategoryList() {
	r.mockHelpdeskGetHelpdeskCategoryList = nil
}

// GetHelpdeskCategoryListReq ...
type GetHelpdeskCategoryListReq struct {
	Lang    *string `query:"lang" json:"-"`     // 知识库分类语言, 示例值: "zh_cn"
	OrderBy *int64  `query:"order_by" json:"-"` // 排序键。1: 根据知识库分类更新时间排序, 示例值: 1
	Asc     *bool   `query:"asc" json:"-"`      // 顺序。true: 正序；false: 反序, 示例值: true
}

// GetHelpdeskCategoryListResp ...
type GetHelpdeskCategoryListResp struct {
	Categories []*HelpdeskCategory `json:"categories,omitempty"` // 知识库分类列表
}

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