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

// GetLingoClassificationList 获取飞书词典当前分类。
//
// 飞书词典目前为二级分类体系, 每个词条可添加多个二级分类, 但选择的二级分类必须从属于不同的一级分类。
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/lingo-v1/classification/list
func (r *LingoService) GetLingoClassificationList(ctx context.Context, request *GetLingoClassificationListReq, options ...MethodOptionFunc) (*GetLingoClassificationListResp, *Response, error) {
	if r.cli.mock.mockLingoGetLingoClassificationList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Lingo#GetLingoClassificationList mock enable")
		return r.cli.mock.mockLingoGetLingoClassificationList(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Lingo",
		API:                   "GetLingoClassificationList",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/lingo/v1/classifications",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getLingoClassificationListResp)

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

// MockLingoGetLingoClassificationList mock LingoGetLingoClassificationList method
func (r *Mock) MockLingoGetLingoClassificationList(f func(ctx context.Context, request *GetLingoClassificationListReq, options ...MethodOptionFunc) (*GetLingoClassificationListResp, *Response, error)) {
	r.mockLingoGetLingoClassificationList = f
}

// UnMockLingoGetLingoClassificationList un-mock LingoGetLingoClassificationList method
func (r *Mock) UnMockLingoGetLingoClassificationList() {
	r.mockLingoGetLingoClassificationList = nil
}

// GetLingoClassificationListReq ...
type GetLingoClassificationListReq struct {
	PageSize  *int64  `query:"page_size" json:"-"`  // 分页大小, 示例值: 20, 默认值: `20`, 取值范围: `1` ～ `500`
	PageToken *string `query:"page_token" json:"-"` // 分页标记, 第一次请求不填, 表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: 408ecac018b2e3518db37275e812aad7bb8ad3e755fc886f322ac6c430ba
	RepoID    *string `query:"repo_id" json:"-"`    // 词库ID（不传默认范围为全员词库）, 如以应用身份获取非全员词库中的分类, 需要在“词库设置”页面添加应用；若以用户身份获取非全员词库中的分类, 该用户需要拥有对应词库的可见权限, 示例值: 7202510112396640276
}

// GetLingoClassificationListResp ...
type GetLingoClassificationListResp struct {
	Items     []*GetLingoClassificationListRespItem `json:"items,omitempty"`      // 分类
	PageToken string                                `json:"page_token,omitempty"` // 分页标记, 当 has_more 为 true 时, 会同时返回新的 page_token, 否则不返回 page_token
	HasMore   bool                                  `json:"has_more,omitempty"`   // 是否还有更多项
}

// GetLingoClassificationListRespItem ...
type GetLingoClassificationListRespItem struct {
	ID        string                                        `json:"id,omitempty"`         // 二级分类 ID
	Name      string                                        `json:"name,omitempty"`       // 二级分类名称
	FatherID  string                                        `json:"father_id,omitempty"`  // 对应一级分类 ID
	I18nNames []*GetLingoClassificationListRespItemI18nName `json:"i18n_names,omitempty"` // 国际化分类名
}

// GetLingoClassificationListRespItemI18nName ...
type GetLingoClassificationListRespItemI18nName struct {
	Language int64  `json:"language,omitempty"` // 语言类型, 可选值有: 1: 中文, 2: 英文, 3: 日文
	Name     string `json:"name,omitempty"`     // 分类名
}

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