Trying to audit OAuth clients in our org using the TypeScript SDK. The oauthClientApi methods are a bit sparse. I can list the clients with listOAuthClients, but that only returns basic metadata. There’s no obvious method to fetch the assigned scopes for each client in a single pass. I’m currently looping through the results and calling getOAuthClient for each ID to grab the scopes property. It feels inefficient and hits rate limits quickly if we have hundreds of clients. Is there a bulk endpoint or a missing SDK method for this? Here’s the current approach:
import { OAuthClientApi } from '@genesyscloud/oauth-client';
const api = new OAuthClientApi();
const clients = await api.listOAuthClients();
const details = await Promise.all(
clients.entities.map(async (c) => {
const full = await api.getOAuthClient(c.id);
return { id: c.id, scopes: full.scopes };
})
);
The getOAuthClient response does include the scopes array, but fetching them individually is slow. I checked the API docs for /api/v2/oauth/clients and it mentions a expand parameter, but the SDK doesn’t expose it in the ListOAuthClientsOptions interface. I tried passing it manually via apiClient.callApi, but the typing breaks down. Does the SDK support the expand=scopes query param for the list endpoint? Or is there a better way to get this data without N+1 calls? We’re hitting 429s during the audit script runs. Need a cleaner way to map client IDs to their granted scopes. The current loop works but it’s ugly and fragile. Any thoughts on extending the SDK or using a different endpoint?