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

// MGetIMTag 根据标签 ID 查询标签信息。
//
// doc: https://open.larkoffice.com/document/uAjLw4CM/ukTMukTMukTM/group/im-v2/tag/list
func (r *MessageService) MGetIMTag(ctx context.Context, request *MGetIMTagReq, options ...MethodOptionFunc) (*MGetIMTagResp, *Response, error) {
	if r.cli.mock.mockMessageMGetIMTag != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Message#MGetIMTag mock enable")
		return r.cli.mock.mockMessageMGetIMTag(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Message",
		API:                   "MGetIMTag",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/im/v2/tags",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
	}
	resp := new(mGetIMTagResp)

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

// MockMessageMGetIMTag mock MessageMGetIMTag method
func (r *Mock) MockMessageMGetIMTag(f func(ctx context.Context, request *MGetIMTagReq, options ...MethodOptionFunc) (*MGetIMTagResp, *Response, error)) {
	r.mockMessageMGetIMTag = f
}

// UnMockMessageMGetIMTag un-mock MessageMGetIMTag method
func (r *Mock) UnMockMessageMGetIMTag() {
	r.mockMessageMGetIMTag = nil
}

// MGetIMTagReq ...
type MGetIMTagReq struct {
	IDs []string `query:"ids" json:"-"` // 标签 ID, 示例值: 716168xxxxx, 长度范围: `0` ～ `40`
}

// MGetIMTagResp ...
type MGetIMTagResp struct {
	TagInfos []*MGetIMTagRespTagInfo `json:"tag_infos,omitempty"` // 标签信息
}

// MGetIMTagRespTagInfo ...
type MGetIMTagRespTagInfo struct {
	ID         string                          `json:"id,omitempty"`          // 标签 ID
	TagType    string                          `json:"tag_type,omitempty"`    // 标签类型
	Name       string                          `json:"name,omitempty"`        // 标签名称
	I18nNames  []*MGetIMTagRespTagInfoI18nName `json:"i18n_names,omitempty"`  // i18n 多语言名称集合
	CreateTime string                          `json:"create_time,omitempty"` // 创建时间
	UpdateTime string                          `json:"update_time,omitempty"` // 更新时间
}

// MGetIMTagRespTagInfoI18nName ...
type MGetIMTagRespTagInfoI18nName struct {
	Locale string `json:"locale,omitempty"` // 语言
	Name   string `json:"name,omitempty"`   // 名称
}

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