Skip to content

Commit

Permalink
新增getUserIdList接口 (#10)
Browse files Browse the repository at this point in the history
* 新增getUserIdList接口

* 修改命名规范
  • Loading branch information
ityifan committed Nov 21, 2023
1 parent 0c37773 commit 8cc2c52
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/services/WxWorkMemberService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ export class WxWorkMemberService extends WxWorkServiceAuth {
return result as WxWork.UserList
}

// 获取部门成员详情 https://work.weixin.qq.com/api/doc/90000/90135/90201
async getUserIdList(cursor = '', limit = 10000) {
const result = await this.bin.post(
'/cgi-bin/user/list_id',
{ cursor, limit },
{ access_token: await this.getToken() }
)
return result as WxWork.getUserIdList
}
// 通过ID获取用户 https://work.weixin.qq.com/api/doc/90000/90135/90196
async getUserById(userid: string) {
const result = await this.bin.get('/cgi-bin/user/get', {
Expand Down
12 changes: 11 additions & 1 deletion src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ const resultUserList = {
},
],
}
const resultGetUserIdList = {
errcode: 0,
errmsg: "ok",
dept_user: [
{
userid: "13530022094",
department: 2000490
},
]
}

const resultUserInfoByCode = {
errcode: 0,
Expand Down Expand Up @@ -237,6 +247,6 @@ export declare namespace WxWork {
type CreateDepartmentResponse = typeof departmentResponse
type DepartmentList = typeof departmentList
type User = Partial<typeof user>

type getUserIdList = typeof resultGetUserIdList
type MessageResponse = typeof messageResponse
}

0 comments on commit 8cc2c52

Please sign in to comment.