node-zendesk icon indicating copy to clipboard operation
node-zendesk copied to clipboard

list users by multiple roles

Open goldylucks opened this issue 2 years ago • 2 comments

Not sure this is supported, I'm trying to do this:

zdApi.users.listWithFilter("role", ["admin", "agent"])

and getting empty response.

this however works:

zdApi.users.listWithFilter("role", "admin")

happy to submit a PR with a bit of guidance, I started developing my own zd client module and then saw this library :)

btw, that method isn't on the docs nor on the types library, happy to add it there as well!

goldylucks avatar Apr 01 '22 15:04 goldylucks

After poking around the code a bit, I tried to hack it like this:

  zdApi.requestAll(
    "GET",
    "users/list?role[]?=admin&role[]=agent",
  )

but it isn't exposed on the client

goldylucks avatar Apr 01 '22 15:04 goldylucks

A nice API could be:

zdApi.users.list({options}, cb)

// i.e.
zdApi.users.list({role: ["agent", "admin"]}, cb)

goldylucks avatar Apr 01 '22 15:04 goldylucks