def update(self, params=None): if not isinstance(params, dict): params = {} if hasattr(self, "id") and self.id: params['id'] = self.id else: raise MissingParameterError("Current object doesn't have a id") if "id" not in params: raise MissingParameterError("Parameter missing: id") if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "name" in params and not isinstance(params["name"], str): raise InvalidParameterError("Bad parameter: name must be an str") if "expires_at" in params and not isinstance(params["expires_at"], str): raise InvalidParameterError( "Bad parameter: expires_at must be an str") if "permission_set" in params and not isinstance( params["permission_set"], str): raise InvalidParameterError( "Bad parameter: permission_set must be an str") response, _options = Api.send_request( "PATCH", "/api_keys/{id}".format(id=params['id']), params, self.options) return response.data
def begin_upload(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 "part" in params and not isinstance(params["part"], int): raise InvalidParameterError("Bad parameter: part must be an int") if "parts" in params and not isinstance(params["parts"], int): raise InvalidParameterError("Bad parameter: parts must be an int") if "ref" in params and not isinstance(params["ref"], str): raise InvalidParameterError("Bad parameter: ref must be an str") if "restart" in params and not isinstance(params["restart"], int): raise InvalidParameterError( "Bad parameter: restart must be an int") response, _options = Api.send_request( "POST", "/file_actions/begin_upload/{path}".format(path=params['path']), params, self.options) return response.data
def update(self, params=None): if not isinstance(params, dict): params = {} if hasattr(self, "id") and self.id: params['id'] = self.id else: raise MissingParameterError("Current object doesn't have a id") if "id" not in params: raise MissingParameterError("Parameter missing: id") if "project_id" not in params: raise MissingParameterError("Parameter missing: project_id") if "subject" not in params: raise MissingParameterError("Parameter missing: subject") if "body" not in params: raise MissingParameterError("Parameter missing: body") if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "project_id" in params and not isinstance(params["project_id"], int): raise InvalidParameterError( "Bad parameter: project_id must be an int") if "subject" in params and not isinstance(params["subject"], str): raise InvalidParameterError( "Bad parameter: subject must be an str") if "body" in params and not isinstance(params["body"], str): raise InvalidParameterError("Bad parameter: body must be an str") response, _options = Api.send_request( "PATCH", "/messages/{id}".format(id=params['id']), params, self.options) return response.data
def create(path, params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["path"] = 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 "length" in params and not isinstance(params["length"], int): raise InvalidParameterError("Bad parameter: length must be an int") if "part" in params and not isinstance(params["part"], int): raise InvalidParameterError("Bad parameter: part must be an int") if "parts" in params and not isinstance(params["parts"], int): raise InvalidParameterError("Bad parameter: parts must be an int") if "provided_mtime" in params and not isinstance(params["provided_mtime"], str): raise InvalidParameterError( "Bad parameter: provided_mtime must be an str") if "ref" in params and not isinstance(params["ref"], str): raise InvalidParameterError("Bad parameter: ref must be an str") if "restart" in params and not isinstance(params["restart"], int): raise InvalidParameterError("Bad parameter: restart must be an int") if "size" in params and not isinstance(params["size"], int): raise InvalidParameterError("Bad parameter: size must be an int") if "structure" in params and not isinstance(params["structure"], str): raise InvalidParameterError("Bad parameter: structure must be an str") if "path" not in params: raise MissingParameterError("Parameter missing: path") response, options = Api.send_request( "POST", "/files/{path}".format(path=params['path']), params, options) return File(response.data, options)
def update(id, params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["id"] = id if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "project_id" in params and not isinstance(params["project_id"], int): raise InvalidParameterError("Bad parameter: project_id must be an int") if "subject" in params and not isinstance(params["subject"], str): raise InvalidParameterError("Bad parameter: subject must be an str") if "body" in params and not isinstance(params["body"], str): raise InvalidParameterError("Bad parameter: body must be an str") if "id" not in params: raise MissingParameterError("Parameter missing: id") if "project_id" not in params: raise MissingParameterError("Parameter missing: project_id") if "subject" not in params: raise MissingParameterError("Parameter missing: subject") if "body" not in params: raise MissingParameterError("Parameter missing: body") response, options = Api.send_request( "PATCH", "/messages/{id}".format(id=params['id']), params, options) return Message(response.data, options)
def list(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "sort_by" in params and not isinstance(params["sort_by"], dict): raise InvalidParameterError("Bad parameter: sort_by must be an dict") if "filter" in params and not isinstance(params["filter"], dict): raise InvalidParameterError("Bad parameter: filter must be an dict") if "filter_gt" in params and not isinstance(params["filter_gt"], dict): raise InvalidParameterError("Bad parameter: filter_gt must be an dict") if "filter_gteq" in params and not isinstance(params["filter_gteq"], dict): raise InvalidParameterError( "Bad parameter: filter_gteq must be an dict") if "filter_like" in params and not isinstance(params["filter_like"], dict): raise InvalidParameterError( "Bad parameter: filter_like must be an dict") if "filter_lt" in params and not isinstance(params["filter_lt"], dict): raise InvalidParameterError("Bad parameter: filter_lt must be an dict") if "filter_lteq" in params and not isinstance(params["filter_lteq"], dict): raise InvalidParameterError( "Bad parameter: filter_lteq must be an dict") if "behavior" in params and not isinstance(params["behavior"], str): raise InvalidParameterError("Bad parameter: behavior must be an str") return ListObj(Behavior, "GET", "/behaviors", params, options)
def begin_upload(path, params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["path"] = path if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "part" in params and not isinstance(params["part"], int): raise InvalidParameterError("Bad parameter: part must be an int") if "parts" in params and not isinstance(params["parts"], int): raise InvalidParameterError("Bad parameter: parts must be an int") if "ref" in params and not isinstance(params["ref"], str): raise InvalidParameterError("Bad parameter: ref must be an str") if "restart" in params and not isinstance(params["restart"], int): raise InvalidParameterError("Bad parameter: restart must be an int") if "path" not in params: raise MissingParameterError("Parameter missing: path") response, options = Api.send_request( "POST", "/file_actions/begin_upload/{path}".format(path=params['path']), params, options) return [ FileUploadPart(entity_data, options) for entity_data in response.data ]
def list(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") return ListObj(IpAddress, "GET", "/ip_addresses", params, options)
def list(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") return ListObj(UserCipherUse, "GET", "/user_cipher_uses", params, options)
def create(params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "body" in params and not isinstance(params["body"], str): raise InvalidParameterError("Bad parameter: body must be an str") if "body" not in params: raise MissingParameterError("Parameter missing: body") response, options = Api.send_request("POST", "/message_comments", params, options) return MessageComment(response.data, options)
def create(params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "title" in params and not isinstance(params["title"], str): raise InvalidParameterError("Bad parameter: title must be an str") if "form_fields" in params and not isinstance(params["form_fields"], list): raise InvalidParameterError("Bad parameter: form_fields must be an list") response, options = Api.send_request("POST", "/form_field_sets", params, options) return FormFieldSet(response.data, options)
def create(path, params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["path"] = path if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "timeout" in params and not isinstance(params["timeout"], int): raise InvalidParameterError("Bad parameter: timeout must be an int") if "path" not in params: raise MissingParameterError("Parameter missing: path") response, options = Api.send_request("POST", "/locks/{path}".format(path=params['path']), params, options) return Lock(response.data, options)
def list(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "sort_by" in params and not isinstance(params["sort_by"], dict): raise InvalidParameterError("Bad parameter: sort_by must be an dict") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") return ListObj(Request, "GET", "/requests", params, options)
def update_current(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "expires_at" in params and not isinstance(params["expires_at"], str): raise InvalidParameterError("Bad parameter: expires_at must be an str") if "name" in params and not isinstance(params["name"], str): raise InvalidParameterError("Bad parameter: name must be an str") if "permission_set" in params and not isinstance(params["permission_set"], str): raise InvalidParameterError( "Bad parameter: permission_set must be an str") response, options = Api.send_request("PATCH", "/api_key", params, options) return ApiKey(response.data, options)
def create(params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "group_id" in params and not isinstance(params["group_id"], int): raise InvalidParameterError("Bad parameter: group_id must be an int") if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "group_id" not in params: raise MissingParameterError("Parameter missing: group_id") if "user_id" not in params: raise MissingParameterError("Parameter missing: user_id") response, options = Api.send_request("POST", "/group_users", params, options) return GroupUser(response.data, options)
def list_for(path, params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["path"] = path if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "path" not in params: raise MissingParameterError("Parameter missing: path") return ListObj(Lock,"GET", "/locks/{path}".format(path=params['path']), params, options)
def update(id, params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["id"] = id if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "title" in params and not isinstance(params["title"], str): raise InvalidParameterError("Bad parameter: title must be an str") if "form_fields" in params and not isinstance(params["form_fields"], list): raise InvalidParameterError("Bad parameter: form_fields must be an list") if "id" not in params: raise MissingParameterError("Parameter missing: id") response, options = Api.send_request("PATCH", "/form_field_sets/{id}".format(id=params['id']), params, options) return FormFieldSet(response.data, options)
def list(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "project_id" in params and not isinstance(params["project_id"], int): raise InvalidParameterError("Bad parameter: project_id must be an int") if "project_id" not in params: raise MissingParameterError("Parameter missing: project_id") return ListObj(Message, "GET", "/messages", params, options)
def delete(path, params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["path"] = path if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "token" in params and not isinstance(params["token"], str): raise InvalidParameterError("Bad parameter: token must be an str") if "path" not in params: raise MissingParameterError("Parameter missing: path") if "token" not in params: raise MissingParameterError("Parameter missing: token") response, _options = Api.send_request("DELETE", "/locks/{path}".format(path=params['path']), params, options) return response.data
def create(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "body" in params and not isinstance(params["body"], str): raise InvalidParameterError("Bad parameter: body must be an str") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "body" not in params: raise MissingParameterError("Parameter missing: body") if "path" not in params: raise MissingParameterError("Parameter missing: path") response, options = Api.send_request("POST", "/file_comments", params, options) return FileComment(response.data, options)
def update(id, params = None, options = None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["id"] = id if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "global_access" in params and not isinstance(params["global_access"], str): raise InvalidParameterError("Bad parameter: global_access must be an str") if "id" not in params: raise MissingParameterError("Parameter missing: id") if "global_access" not in params: raise MissingParameterError("Parameter missing: global_access") response, options = Api.send_request("PATCH", "/projects/{id}".format(id=params['id']), params, options) return Project(response.data, options)
def list(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "folder_behavior_id" in params and not isinstance( params["folder_behavior_id"], int): raise InvalidParameterError( "Bad parameter: folder_behavior_id must be an int") if "folder_behavior_id" not in params: raise MissingParameterError("Parameter missing: folder_behavior_id") return ListObj(InboxRegistration, "GET", "/inbox_registrations", params, options)
def create(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "value" in params and not isinstance(params["value"], str): raise InvalidParameterError("Bad parameter: value must be an str") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "behavior" in params and not isinstance(params["behavior"], str): raise InvalidParameterError("Bad parameter: behavior must be an str") if "path" not in params: raise MissingParameterError("Parameter missing: path") if "behavior" not in params: raise MissingParameterError("Parameter missing: behavior") response, options = Api.send_request("POST", "/behaviors", params, options) return Behavior(response.data, options)
def create(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "username" in params and not isinstance(params["username"], str): raise InvalidParameterError("Bad parameter: username must be an str") if "password" in params and not isinstance(params["password"], str): raise InvalidParameterError("Bad parameter: password must be an str") if "otp" in params and not isinstance(params["otp"], str): raise InvalidParameterError("Bad parameter: otp must be an str") if "partial_session_id" in params and not isinstance( params["partial_session_id"], str): raise InvalidParameterError( "Bad parameter: partial_session_id must be an str") response, options = Api.send_request("POST", "/sessions", params, options) return Session(response.data, options)
def list_for_folder(path, params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["path"] = path if "start_at" in params and not isinstance(params["start_at"], str): raise InvalidParameterError("Bad parameter: start_at must be an str") if "end_at" in params and not isinstance(params["end_at"], str): raise InvalidParameterError("Bad parameter: end_at must be an str") if "display" in params and not isinstance(params["display"], str): raise InvalidParameterError("Bad parameter: display must be an str") if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "sort_by" in params and not isinstance(params["sort_by"], dict): raise InvalidParameterError("Bad parameter: sort_by must be an dict") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "path" not in params: raise MissingParameterError("Parameter missing: path") return ListObj(Action, "GET", "/history/folders/{path}".format(path=params['path']), params, options)
def list_for_user(user_id, params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["user_id"] = user_id if "start_at" in params and not isinstance(params["start_at"], str): raise InvalidParameterError("Bad parameter: start_at must be an str") if "end_at" in params and not isinstance(params["end_at"], str): raise InvalidParameterError("Bad parameter: end_at must be an str") if "display" in params and not isinstance(params["display"], str): raise InvalidParameterError("Bad parameter: display must be an str") if "cursor" in params and not isinstance(params["cursor"], str): raise InvalidParameterError("Bad parameter: cursor must be an str") if "per_page" in params and not isinstance(params["per_page"], int): raise InvalidParameterError("Bad parameter: per_page must be an int") if "sort_by" in params and not isinstance(params["sort_by"], dict): raise InvalidParameterError("Bad parameter: sort_by must be an dict") if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "user_id" not in params: raise MissingParameterError("Parameter missing: user_id") return ListObj( Action, "GET", "/history/users/{user_id}".format(user_id=params['user_id']), params, options)
def update(self, params = None): if not isinstance(params, dict): params = {} if hasattr(self, "id") and self.id: params['id'] = self.id else: raise MissingParameterError("Current object doesn't have a id") if "id" not in params: raise MissingParameterError("Parameter missing: id") if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "title" in params and not isinstance(params["title"], str): raise InvalidParameterError("Bad parameter: title must be an str") if "form_fields" in params and not isinstance(params["form_fields"], list): raise InvalidParameterError("Bad parameter: form_fields must be an list") response, _options = Api.send_request("PATCH", "/form_field_sets/{id}".format(id=params['id']), params, self.options) return response.data
def create(params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} if "group_id" in params and not isinstance(params["group_id"], int): raise InvalidParameterError("Bad parameter: group_id must be an int") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "permission" in params and not isinstance(params["permission"], str): raise InvalidParameterError("Bad parameter: permission must be an str") if "user_id" in params and not isinstance(params["user_id"], int): raise InvalidParameterError("Bad parameter: user_id must be an int") if "username" in params and not isinstance(params["username"], str): raise InvalidParameterError("Bad parameter: username must be an str") response, options = Api.send_request("POST", "/permissions", params, options) return Permission(response.data, options)
def update(id, params=None, options=None): if not isinstance(params, dict): params = {} if not isinstance(options, dict): options = {} params["id"] = id if "id" in params and not isinstance(params["id"], int): raise InvalidParameterError("Bad parameter: id must be an int") if "send_interval" in params and not isinstance(params["send_interval"], str): raise InvalidParameterError( "Bad parameter: send_interval must be an str") if "id" not in params: raise MissingParameterError("Parameter missing: id") response, options = Api.send_request( "PATCH", "/notifications/{id}".format(id=params['id']), params, options) return Notification(response.data, options)
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 "token" not in params: raise MissingParameterError("Parameter missing: token") if "path" in params and not isinstance(params["path"], str): raise InvalidParameterError("Bad parameter: path must be an str") if "token" in params and not isinstance(params["token"], str): raise InvalidParameterError("Bad parameter: token must be an str") response, _options = Api.send_request("DELETE", "/locks/{path}".format(path=params['path']), params, self.options) return response.data