Best practice to get user data like quota and credentials in an app

Ubuntu 18.04
NC 16.0.10
PHP 7.2.17
Myssql 10.4.4

I’m trying to create an app in Nextcloud right now that involes creating some new files. I want to provide the user a warning if one or more of the new files are larger than their available quota / free space.

Right now I get the user quota through a curl request with the client api. This solution doesn’t seem to be very good as its more traffic and with the current implemantation requires some admin user credential to be in the code.

What is the best way to get the current user’s quota, or atleast other user data such as credentials, inside my nextcloud app?

If you want to check in the backend might be helpful.