Get filenames from branch (need master branch) when pull request is created

Hey. I am developing a bitbucket plugin now.
I’m sorry, but I didn’t find a service anywhere that allows me to get the names of all filenames from the branch (I need the master branch specifically) when the pull request is created.

I successfully received the filenames from the pool request. Now I need to compare from with filenames from the master branch (or rather with the branch into which the pull request is).

Please, tell anyone. Is it possible or not?