diff --git a/farmOS/__init__.py b/farmOS/__init__.py index 0c8d797..5968b78 100644 --- a/farmOS/__init__.py +++ b/farmOS/__init__.py @@ -7,7 +7,7 @@ from oauthlib.oauth2 import InvalidGrantError, InvalidClientError, InvalidScopeError from .session import OAuthSession -from .client import LogAPI, AssetAPI, TermAPI, AreaAPI, info +from .client import LogAPI, AssetAPI, TermAPI, AreaAPI, FileAPI, info logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) @@ -125,6 +125,7 @@ def __init__( self.asset = AssetAPI(self.session) self.area = AreaAPI(self.session) self.term = TermAPI(self.session) + self.file = FileAPI(self.session) self.info = partial(info, self.session) def authorize(self, username=None, password=None, scope="user_access"): diff --git a/farmOS/client.py b/farmOS/client.py index c91e28f..bc34010 100644 --- a/farmOS/client.py +++ b/farmOS/client.py @@ -237,6 +237,14 @@ def get(self, filters=None): return data +class FileAPI(BaseAPI): + """API for interacting with farm files""" + + def __init__(self, session): + # Define 'file' as the farmOS API entity endpoint + super().__init__(session=session, entity_type="file") + + def info(session): """Retrieve info about the farmOS server."""