'Query Google Analytics Data API by Client Id

I am switching from Google Analytics universal to GA4. In doing so, I am now using the Google Analytics Data API. One feature I used to use was running reports based on client id. I don't see the ability to do this with the Google Analytics Data API. Can you please show me how I would accomplish the below code with the new API?

const reporting = google.analyticsreporting('v4');
const viewId = this.configService.get<string>('googleAnalytics.viewId');
const params = {
  viewId,
  user: {
    type: 'CLIENT_ID',
    userId: 123456.12312312,
  },
}
const clientEmail = this.configService.get<string>('googleAnalytics.clientEmail');
const privateKey = this.configService.get<string>('googleAnalytics.privateKey');
const scope = this.configService.get<string[]>('googleAnalytics.scope');
const jwt = new google.auth.JWT(clientEmail, null, privateKey, scope);
const request = {
  headers: { 'Content-Type': 'application/json' },
  auth: jwt,
  resource: params,
};
reporting.userActivity.search(request);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source