Is there a library for switches?

In build, create new .cpp and .hpp files and then copy/paste the source from the respective files from github.

While you can use an interrupt with the input

https://docs.particle.io/reference/firmware/core/#attachinterrupt-

it becomes problematic when the input is a bouncy switch. See this: