larksuite / larksuite/oapi-sdk-java

com.lark.oapi.service.directory找不到

Open
#170 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
310
Forks
115
PR merge metrics
No merged PRs in 30d

Description

组织架构-员工管理-批量获取员工列表的API Java SDK的示例中com.lark.oapi.service.directory.v1.model.; 找不到,请问该如何引入此包呢?
示例代码如下:
`package com.lark.oapi.sample.apiall.directoryv1;
import com.google.gson.JsonParser;
import com.lark.oapi.Client;
import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.service.directory.v1.model.
;
import java.util.HashMap;
import com.lark.oapi.core.request.RequestOptions;

// SDK 使用文档:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/server-side-sdk/java-sdk-guide/preparations
// 复制该 Demo 后, 需要将 "YOUR_APP_ID", "YOUR_APP_SECRET" 替换为自己应用的 APP_ID, APP_SECRET.
// 以下示例代码默认根据文档示例值填充,如果存在代码问题,请在 API 调试台填上相关必要参数后再复制代码使用
public class FilterEmployeeSample {

public static void main(String arg[]) throws Exception {
	// 构建client
	Client client = Client.newBuilder("YOUR_APP_ID", "YOUR_APP_SECRET").build();

	// 创建请求对象
	FilterEmployeeReq req = FilterEmployeeReq.newBuilder()
		.employeeIdType("")
		.departmentIdType("")
		.filterEmployeeReqBody(FilterEmployeeReqBody.newBuilder()
			.filter()
			.requiredFields()
			.pageRequest()
			.build())
		.build();

	// 发起请求
	FilterEmployeeResp resp = client.directory().v1().employee().filter(req, RequestOptions.newBuilder()
		.userAccessToken("")
		.build());

	// 处理服务端错误
	if(!resp.success()) {
		System.out.println(String.format("code:%s,msg:%s,reqId:%s, resp:%s",
			resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), StandardCharsets.UTF_8)))));
		return;
	}

	// 业务数据处理
	System.out.println(Jsons.DEFAULT.toJson(resp.getData()));
}

}`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Java SDK preparations guide linked in the issue and inspect how the example obtains com.lark.oapi.service.directory.v1.model.*. Confirm the dependency or generated package used by the FilterEmployeeSample example, then verify that the sample imports and builds successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.