Module: JPSClient::API::LarkDepartment

Included in:
Client
Defined in:
lib/jpsclient/api/lark_department.rb

Overview

LarkDepartment 相关 API 处理飞书部门管理相关接口

Instance Method Summary collapse

Instance Method Details

#get_lark_department_list(parent_department_id: nil, fetch_child: true, page_size: 50, page_token: nil) ⇒ Hash Also known as: get_all_lark_departments

获取飞书部门列表

Parameters:

  • parent_department_id (String) (defaults to: nil)

    父部门ID(可选,不填则获取所有部门)

  • fetch_child (Boolean) (defaults to: true)

    是否递归获取子部门(可选,默认true)

  • page_size (Integer) (defaults to: 50)

    分页大小(可选,默认50,最大50)

  • page_token (String) (defaults to: nil)

    分页标记(可选)

Returns:

  • (Hash)

    API响应

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jpsclient/api/lark_department.rb', line 14

def get_lark_department_list(parent_department_id: nil, fetch_child: true, page_size: 50, page_token: nil)
  config = @request_config && @request_config["lark_department_all"]
  raise JPSClient::ExceptionError, "Missing config for lark_department_all" unless config && config["url"]

  path = config["url"]

  params = {
    fetch_child: fetch_child,
    page_size: page_size
  }
  params[:parent_department_id] = parent_department_id if parent_department_id
  params[:page_token] = page_token if page_token

  return request_with_auth(:get, path, params: params)
end