Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -904,10 +904,14 @@ usersRes.data.forEach((user) => {
// Search all users, optionally according to tenant and/or role filter
// Results can be paginated using the limit and page parameters
// Additional filters: verifiedEmail, verifiedPhone, statuses, roles, tenantIds, etc.
// Results can also be filtered by time using fromCreatedTime, toCreatedTime,
// fromModifiedTime, and toModifiedTime (epoch in milliseconds)
const usersRes = await descopeClient.management.user.search({
tenantIds: ['tenant-ID'],
verifiedEmail: true, // optional: filter by verified email status
verifiedPhone: false, // optional: filter by verified phone status
fromCreatedTime: 1700000000000, // optional: only users created on or after this time
toModifiedTime: 1800000000000, // optional: only users modified on or before this time
});
console.log('Total users:', usersRes.data.total);
usersRes.data.users.forEach((user) => {
Expand Down
10 changes: 10 additions & 0 deletions lib/management/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,16 @@ const withUser = (httpClient: HttpClient) => {
}),
(data) => ({ users: data.users, total: data.total }),
),
/**
* Search all users. Results can be filtered according to tenants, roles,
* and other attributes on the given SearchRequest, and paginated using
* the limit and page fields.
* @param searchReq.fromCreatedTime only include users created on or after this time (epoch in milliseconds)
* @param searchReq.toCreatedTime only include users created on or before this time (epoch in milliseconds)
* @param searchReq.fromModifiedTime only include users modified on or after this time (epoch in milliseconds)
* @param searchReq.toModifiedTime only include users modified on or before this time (epoch in milliseconds)
Comment on lines +681 to +684

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM — New docs claim inclusive bounds ("on or after"/"on or before"), but the existing field comments at lib/management/user.ts:60-63 say "after"/"before" (exclusive). Same inclusive wording is repeated in README.md:913-914.

Since this PR's whole purpose is documenting these params, the boundary semantics need to be right: anyone chunking a time window (feeding the previous page's max created time into the next fromCreatedTime) will either double-count or skip users at the boundary depending on which is true.

Fix: confirm the actual server-side comparison, then use one consistent phrasing across the JSDoc, the type comments, and the README.

* @returns The users found by the query, along with the total number of matches
*/
search: (searchReq: SearchRequest): Promise<SdkResponse<UserSearchResponse>> =>
transformResponse<UserSearchResponse, UserSearchResponse>(
httpClient.post(apiPaths.user.search, {
Expand Down
Loading