API for turning DND on/off?

Is there a API or other possibilities to turn DND on/off? Or even just turn vibrate and/or notifications on/off?

All help is apreaciated :)