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

// GetBitableAppRoleMemberList 列出自定义角色的协作者
//
// doc: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/bitable-v1/app-role-member/list
// new doc: https://open.feishu.cn/document/server-docs/docs/bitable-v1/advanced-permission/app-role-member/list
func (r *BitableService) GetBitableAppRoleMemberList(ctx context.Context, request *GetBitableAppRoleMemberListReq, options ...MethodOptionFunc) (*GetBitableAppRoleMemberListResp, *Response, error) {
	if r.cli.mock.mockBitableGetBitableAppRoleMemberList != nil {
		r.cli.Log(ctx, LogLevelDebug, "[lark] Bitable#GetBitableAppRoleMemberList mock enable")
		return r.cli.mock.mockBitableGetBitableAppRoleMemberList(ctx, request, options...)
	}

	req := &RawRequestReq{
		Scope:                 "Bitable",
		API:                   "GetBitableAppRoleMemberList",
		Method:                "GET",
		URL:                   r.cli.openBaseURL + "/open-apis/bitable/v1/apps/:app_token/roles/:role_id/members",
		Body:                  request,
		MethodOption:          newMethodOption(options),
		NeedTenantAccessToken: true,
		NeedUserAccessToken:   true,
	}
	resp := new(getBitableAppRoleMemberListResp)

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

// MockBitableGetBitableAppRoleMemberList mock BitableGetBitableAppRoleMemberList method
func (r *Mock) MockBitableGetBitableAppRoleMemberList(f func(ctx context.Context, request *GetBitableAppRoleMemberListReq, options ...MethodOptionFunc) (*GetBitableAppRoleMemberListResp, *Response, error)) {
	r.mockBitableGetBitableAppRoleMemberList = f
}

// UnMockBitableGetBitableAppRoleMemberList un-mock BitableGetBitableAppRoleMemberList method
func (r *Mock) UnMockBitableGetBitableAppRoleMemberList() {
	r.mockBitableGetBitableAppRoleMemberList = nil
}

// GetBitableAppRoleMemberListReq ...
type GetBitableAppRoleMemberListReq struct {
	AppToken  string  `path:"app_token" json:"-"`   // 多维表格的唯一标识符 [app_token 参数说明](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/bitable/notification#8121eebe), 示例值: "appbcbWCzen6D8dezhoCH2RpMAh"
	RoleID    string  `path:"role_id" json:"-"`     // 自定义角色的id, 示例值: "roljRpwIUt"
	PageSize  *int64  `query:"page_size" json:"-"`  // 分页大小, 示例值: 100, 最大值: `100`
	PageToken *string `query:"page_token" json:"-"` // 分页标记, 第一次请求不填, 表示从头开始遍历；分页查询结果还有更多项时会同时返回新的 page_token, 下次遍历可采用该 page_token 获取查询结果, 示例值: xxxxx
}

// GetBitableAppRoleMemberListResp ...
type GetBitableAppRoleMemberListResp struct {
	Items     []*GetBitableAppRoleMemberListRespItem `json:"items,omitempty"`      // 协作者列表
	HasMore   bool                                   `json:"has_more,omitempty"`   // 是否还有更多项
	PageToken string                                 `json:"page_token,omitempty"` // 分页标记, 当 has_more 为 true 时, 会同时返回新的 page_token, 否则不返回 page_token
	Total     int64                                  `json:"total,omitempty"`      // 总数
}

// GetBitableAppRoleMemberListRespItem ...
type GetBitableAppRoleMemberListRespItem struct {
	OpenID           string `json:"open_id,omitempty"`            // 用户的 open_id
	UnionID          string `json:"union_id,omitempty"`           // 用户的 union_id
	UserID           string `json:"user_id,omitempty"`            // 用户的 user_id
	ChatID           string `json:"chat_id,omitempty"`            // 群聊的 chat_id
	DepartmentID     string `json:"department_id,omitempty"`      // 部门的 department_id
	OpenDepartmentID string `json:"open_department_id,omitempty"` // 部门的 open_department_id
	MemberName       string `json:"member_name,omitempty"`        // 协作者名字
	MemberEnName     string `json:"member_en_name,omitempty"`     // 协作者英文名
	MemberType       string `json:"member_type,omitempty"`        // 协作者类型, 可选值有: user: 用户, chat: 群组, department: 部门
}

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