Most reasonably modern (<= 10 years) desktops will have those exposed as D-Bus interfaces.

As the snippet you posted indicates, the service names are likely org.freedesktop.ScreenSaver and org.freedesktop.PowerManagement (easily verfiyable using qdbusviewer or similar tools).

Cheers,
_