WatchEvents
client.events.watch(EventWatchParams { environmentId, organization, resourceTypeFilters } body, RequestOptionsoptions?): EventWatchResponse { operation, resourceId, resourceType } | Stream<EventWatchResponse { operation, resourceId, resourceType } >
POST/gitpod.v1.EventService/WatchEvents
Streams events for all projects, runners, environments, tasks, and services based on the specified scope.
Use this method to:
- Monitor resource changes in real-time
- Track system events
- Receive notifications
The scope parameter determines which events to watch:
- Organization scope (default): Watch all organization-wide events including projects, runners and environments. Task and service events are not included. Use by setting organization=true or omitting the scope.
- Environment scope: Watch events for a specific environment, including its tasks, task executions, and services. Use by setting environment_id to the UUID of the environment to watch.
WatchEvents
import Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
const response = await client.events.watch();
console.log(response.operation);