1- from .endpoint import Endpoint
1+ from .endpoint import Endpoint , api
22from .exceptions import MissingRequiredFieldError
33from .fileuploads_endpoint import Fileuploads
44from .resource_tagger import _ResourceTagger
@@ -27,6 +27,7 @@ def baseurl(self):
2727 return "{0}/sites/{1}/datasources" .format (self .parent_srv .baseurl , self .parent_srv .site_id )
2828
2929 # Get all datasources
30+ @api (version = "2.0" )
3031 def get (self , req_options = None ):
3132 logger .info ('Querying all datasources on site' )
3233 url = self .baseurl
@@ -36,6 +37,7 @@ def get(self, req_options=None):
3637 return all_datasource_items , pagination_item
3738
3839 # Get 1 datasource by id
40+ @api (version = "2.0" )
3941 def get_by_id (self , datasource_id ):
4042 if not datasource_id :
4143 error = "Datasource ID undefined."
@@ -46,6 +48,7 @@ def get_by_id(self, datasource_id):
4648 return DatasourceItem .from_response (server_response .content )[0 ]
4749
4850 # Populate datasource item's connections
51+ @api (version = "2.0" )
4952 def populate_connections (self , datasource_item ):
5053 if not datasource_item .id :
5154 error = 'Datasource item missing ID. Datasource must be retrieved from server first.'
@@ -56,6 +59,7 @@ def populate_connections(self, datasource_item):
5659 logger .info ('Populated connections for datasource (ID: {0})' .format (datasource_item .id ))
5760
5861 # Delete 1 datasource by id
62+ @api (version = "2.0" )
5963 def delete (self , datasource_id ):
6064 if not datasource_id :
6165 error = "Datasource ID undefined."
@@ -65,6 +69,7 @@ def delete(self, datasource_id):
6569 logger .info ('Deleted single datasource (ID: {0})' .format (datasource_id ))
6670
6771 # Download 1 datasource by id
72+ @api (version = "2.0" )
6873 def download (self , datasource_id , filepath = None ):
6974 if not datasource_id :
7075 error = "Datasource ID undefined."
@@ -86,6 +91,7 @@ def download(self, datasource_id, filepath=None):
8691 return os .path .abspath (filepath )
8792
8893 # Update datasource
94+ @api (version = "2.0" )
8995 def update (self , datasource_item ):
9096 if not datasource_item .id :
9197 error = 'Datasource item missing ID. Datasource must be retrieved from server first.'
@@ -102,6 +108,7 @@ def update(self, datasource_item):
102108 return updated_datasource ._parse_common_tags (server_response .content )
103109
104110 # Publish datasource
111+ @api (version = "2.0" )
105112 def publish (self , datasource_item , file_path , mode , connection_credentials = None ):
106113 if not os .path .isfile (file_path ):
107114 error = "File path does not lead to an existing file."
0 commit comments