How do I configure MarkLogic database backups using Gradle?

I am using Gradle build tool for my MarkLogic application. I would like to know how to configure backups with the help of Gradle, I know we can use the MarkLogic UI to do the same but I feel doing it with Gradle will help me understand the whole setup in more detail. Thank you for any help on this.