-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Description
Hello, I was reviewing this SDK to replace our custom implementation but got an issue with the File
class. I was under the impression that some methods were missing.
Diving in the sources I found what looks like a code generation bug. Some functions are inserted in the class definition having for effect to discard the following methods definitions:
files-sdk-python/files_sdk/models/file.py
Lines 261 to 324 in 41a7dee
def download(self, params = None): | |
if not isinstance(params, dict): | |
params = {} | |
if hasattr(self, "path") and self.path: | |
params['path'] = self.path | |
else: | |
raise MissingParameterError("Current object doesn't have a path") | |
if "path" not in params: | |
raise MissingParameterError("Parameter missing: path") | |
if "path" in params and not isinstance(params["path"], str): | |
raise InvalidParameterError("Bad parameter: path must be an str") | |
if "action" in params and not isinstance(params["action"], str): | |
raise InvalidParameterError("Bad parameter: action must be an str") | |
if "preview_size" in params and not isinstance(params["preview_size"], str): | |
raise InvalidParameterError("Bad parameter: preview_size must be an str") | |
response, _options = Api.send_request("GET", "/files/{path}".format(path=params['path']), params, self.options) | |
return response.data | |
# Parameters: | |
# provided_mtime - string - Modified time of file. | |
# priority_color - string - Priority/Bookmark color of file. | |
def update(self, params = None): | |
if not isinstance(params, dict): | |
params = {} | |
if hasattr(self, "path") and self.path: | |
params['path'] = self.path | |
else: | |
raise MissingParameterError("Current object doesn't have a path") | |
if "path" not in params: | |
raise MissingParameterError("Parameter missing: path") | |
if "path" in params and not isinstance(params["path"], str): | |
raise InvalidParameterError("Bad parameter: path must be an str") | |
if "provided_mtime" in params and not isinstance(params["provided_mtime"], str): | |
raise InvalidParameterError("Bad parameter: provided_mtime must be an str") | |
if "priority_color" in params and not isinstance(params["priority_color"], str): | |
raise InvalidParameterError("Bad parameter: priority_color must be an str") | |
response, _options = Api.send_request("PATCH", "/files/{path}".format(path=params['path']), params, self.options) | |
return response.data | |
# Parameters: | |
# recursive - boolean - If true, will recursively delete folers. Otherwise, will error on non-empty folders. | |
def delete(self, params = None): | |
if not isinstance(params, dict): | |
params = {} | |
if hasattr(self, "path") and self.path: | |
params['path'] = self.path | |
else: | |
raise MissingParameterError("Current object doesn't have a path") | |
if "path" not in params: | |
raise MissingParameterError("Parameter missing: path") | |
if "path" in params and not isinstance(params["path"], str): | |
raise InvalidParameterError("Bad parameter: path must be an str") | |
response, _options = Api.send_request("DELETE", "/files/{path}".format(path=params['path']), params, self.options) | |
return response.data | |
def destroy(self, params = None): | |
self.delete(params) | |
def save(self): | |
new_obj = create(self.path, self.get_attributes(), self.options) | |
self.set_attributes(new_obj.get_attributes()) |
Metadata
Metadata
Assignees
Labels
No labels