使用示例

Example of using

我想使用 searchUsers from https://www.npmjs.com/package/jira-client 搜索 JIRA Server 用户 你能提供一个工作示例吗?

我从来没有 returns 任何东西(仅供参考,addNewissue 函数工作正常)

jira.searchUsers("jane.doe").then((user) ->
  console.log(user.length)
).catch (err) ->
  console.error err

嗯,jira 客户端是用 ES6 编写的,我不太熟悉,但我认为 searchUsers 函数实际上需要一个对象参数,而不是列表。

 searchUsers({ username, startAt, maxResults, includeActive, includeInactive }) { ... }

{username, startAt...} 是一个解构赋值,它从单个传递的对象中提取键名并将它们转换为变量。根据函数的注释,您应该传递一个选项对象。 像这样尝试:

jira.searchUsers({username: "jane.doe"}).then((user) ->
  console.log(user.length)
).catch (err) ->
  console.error err