Пример #1
0
    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
Пример #2
0
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
    ]
Пример #3
0
    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
Пример #4
0
def find_current(params=None, options=None):
    if not isinstance(params, dict):
        params = {}
    if not isinstance(options, dict):
        options = {}
    response, options = Api.send_request("GET", "/api_key", params, options)
    return ApiKey(response.data, options)
Пример #5
0
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)
Пример #6
0
    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
Пример #7
0
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 "name" in params and not isinstance(params["name"], str):
        raise InvalidParameterError("Bad parameter: name must be an str")
    if "body" in params and not isinstance(params["body"], str):
        raise InvalidParameterError("Bad parameter: body must be an str")
    if "use_with_bundles" in params and not isinstance(
            params["use_with_bundles"], str):
        raise InvalidParameterError(
            "Bad parameter: use_with_bundles must be an str")
    if "use_with_inboxes" in params and not isinstance(
            params["use_with_inboxes"], str):
        raise InvalidParameterError(
            "Bad parameter: use_with_inboxes must be an str")
    if "use_with_users" in params and not isinstance(params["use_with_users"],
                                                     str):
        raise InvalidParameterError(
            "Bad parameter: use_with_users must be an str")
    if "id" not in params:
        raise MissingParameterError("Parameter missing: id")
    response, options = Api.send_request(
        "PATCH", "/clickwraps/{id}".format(id=params['id']), params, options)
    return Clickwrap(response.data, options)
Пример #8
0
    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 "body" in params and not isinstance(params["body"], str):
            raise InvalidParameterError("Bad parameter: body must be an str")
        if "use_with_bundles" in params and not isinstance(
                params["use_with_bundles"], str):
            raise InvalidParameterError(
                "Bad parameter: use_with_bundles must be an str")
        if "use_with_inboxes" in params and not isinstance(
                params["use_with_inboxes"], str):
            raise InvalidParameterError(
                "Bad parameter: use_with_inboxes must be an str")
        if "use_with_users" in params and not isinstance(
                params["use_with_users"], str):
            raise InvalidParameterError(
                "Bad parameter: use_with_users must be an str")
        response, _options = Api.send_request(
            "PATCH", "/clickwraps/{id}".format(id=params['id']), params,
            self.options)
        return response.data
Пример #9
0
 def load_next_page(self):
     if self.cursor is not None:
         self.params["cursor"] = self.cursor
     response, _options = Api.send_request(self.path, self.method, self.params, self.options)
     self.data = [self.klass(d, self.options) for d in response.data]
     self.cursor = response.headers.get("X-Files-Cursor", None)
     return self
Пример #10
0
def upload_chunks(io, path, options, upload=None, etags=None):
    if not etags:
        etags = []
    bytes_written = 0
    while True:
        headers = {
            "part": 1
        } if not upload else {
            "ref": upload.ref,
            "part": upload.part_number + 1
        }
        upload = file_action.begin_upload(path, headers, options)[0]
        buf = io.read(upload.partsize)
        if buf == b'' or buf == "":  # Empty bytearray means EOF for BytesIO, Empty String means EOF for StringIO
            return (upload, etags, bytes_written)
        if buf is not None:  # None means no data but io still open
            bytes_written += len(buf)
            response = Api.api_client().send_remote_request(
                upload.http_method, upload.upload_uri,
                {"Content-Length": str(len(buf))}, buf)
            if "ETag" in response.headers:
                etags.append({
                    "etag": response.headers["ETag"].strip('"'),
                    "part": upload.part_number
                })
Пример #11
0
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)
Пример #12
0
def delete(params=None, options=None):
    if not isinstance(params, dict):
        params = {}
    if not isinstance(options, dict):
        options = {}
    response, _options = Api.send_request("DELETE", "/sessions", params,
                                          options)
    return response.data
Пример #13
0
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 "automation" in params and not isinstance(params["automation"], str):
        raise InvalidParameterError("Bad parameter: automation must be an str")
    if "source" in params and not isinstance(params["source"], str):
        raise InvalidParameterError("Bad parameter: source must be an str")
    if "destination" in params and not isinstance(params["destination"], str):
        raise InvalidParameterError(
            "Bad parameter: destination must be an str")
    if "destinations" in params and not isinstance(params["destinations"],
                                                   list):
        raise InvalidParameterError(
            "Bad parameter: destinations must be an list")
    if "destination_replace_from" in params and not isinstance(
            params["destination_replace_from"], str):
        raise InvalidParameterError(
            "Bad parameter: destination_replace_from must be an str")
    if "destination_replace_to" in params and not isinstance(
            params["destination_replace_to"], str):
        raise InvalidParameterError(
            "Bad parameter: destination_replace_to must be an str")
    if "interval" in params and not isinstance(params["interval"], str):
        raise InvalidParameterError("Bad parameter: interval must be an str")
    if "path" in params and not isinstance(params["path"], str):
        raise InvalidParameterError("Bad parameter: path must be an str")
    if "user_ids" in params and not isinstance(params["user_ids"], str):
        raise InvalidParameterError("Bad parameter: user_ids must be an str")
    if "group_ids" in params and not isinstance(params["group_ids"], str):
        raise InvalidParameterError("Bad parameter: group_ids must be an str")
    if "schedule" in params and not isinstance(params["schedule"], dict):
        raise InvalidParameterError("Bad parameter: schedule must be an dict")
    if "trigger" in params and not isinstance(params["trigger"], str):
        raise InvalidParameterError("Bad parameter: trigger must be an str")
    if "trigger_actions" in params and not isinstance(
            params["trigger_actions"], list):
        raise InvalidParameterError(
            "Bad parameter: trigger_actions must be an list")
    if "trigger_action_path" in params and not isinstance(
            params["trigger_action_path"], str):
        raise InvalidParameterError(
            "Bad parameter: trigger_action_path must be an str")
    if "value" in params and not isinstance(params["value"], dict):
        raise InvalidParameterError("Bad parameter: value must be an dict")
    if "id" not in params:
        raise MissingParameterError("Parameter missing: id")
    if "automation" not in params:
        raise MissingParameterError("Parameter missing: automation")
    response, options = Api.send_request(
        "PATCH", "/automations/{id}".format(id=params['id']), params, options)
    return Automation(response.data, options)
Пример #14
0
def create(params = None, options = None):
    if not isinstance(params, dict):
        params = {}
    if not isinstance(options, dict):
        options = {}
    if "global_access" in params and not isinstance(params["global_access"], str):
        raise InvalidParameterError("Bad parameter: global_access must be an str")
    if "global_access" not in params:
        raise MissingParameterError("Parameter missing: global_access")
    response, options = Api.send_request("POST", "/projects", params, options)
    return Project(response.data, options)
Пример #15
0
def delete(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 "id" not in params:
        raise MissingParameterError("Parameter missing: id")
    response, _options = Api.send_request("DELETE", "/remote_servers/{id}".format(id=params['id']), params, options)
    return response.data
Пример #16
0
def find(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 "id" not in params:
        raise MissingParameterError("Parameter missing: id")
    response, options = Api.send_request("GET", "/projects/{id}".format(id=params['id']), params, options)
    return Project(response.data, options)
Пример #17
0
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)
Пример #18
0
def find(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 "path" not in params:
        raise MissingParameterError("Parameter missing: path")
    response, options = Api.send_request(
        "GET", "/styles/{path}".format(path=params['path']), params, options)
    return Style(response.data, options)
Пример #19
0
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)
Пример #20
0
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 "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 "query_action" in params and not isinstance(params["query_action"], str):
        raise InvalidParameterError("Bad parameter: query_action must be an str")
    if "query_interface" in params and not isinstance(params["query_interface"], str):
        raise InvalidParameterError("Bad parameter: query_interface must be an str")
    if "query_user_id" in params and not isinstance(params["query_user_id"], str):
        raise InvalidParameterError("Bad parameter: query_user_id must be an str")
    if "query_file_id" in params and not isinstance(params["query_file_id"], str):
        raise InvalidParameterError("Bad parameter: query_file_id must be an str")
    if "query_parent_id" in params and not isinstance(params["query_parent_id"], str):
        raise InvalidParameterError("Bad parameter: query_parent_id must be an str")
    if "query_path" in params and not isinstance(params["query_path"], str):
        raise InvalidParameterError("Bad parameter: query_path must be an str")
    if "query_folder" in params and not isinstance(params["query_folder"], str):
        raise InvalidParameterError("Bad parameter: query_folder must be an str")
    if "query_src" in params and not isinstance(params["query_src"], str):
        raise InvalidParameterError("Bad parameter: query_src must be an str")
    if "query_destination" in params and not isinstance(params["query_destination"], str):
        raise InvalidParameterError("Bad parameter: query_destination must be an str")
    if "query_ip" in params and not isinstance(params["query_ip"], str):
        raise InvalidParameterError("Bad parameter: query_ip must be an str")
    if "query_username" in params and not isinstance(params["query_username"], str):
        raise InvalidParameterError("Bad parameter: query_username must be an str")
    if "query_failure_type" in params and not isinstance(params["query_failure_type"], str):
        raise InvalidParameterError("Bad parameter: query_failure_type must be an str")
    if "query_target_id" in params and not isinstance(params["query_target_id"], str):
        raise InvalidParameterError("Bad parameter: query_target_id must be an str")
    if "query_target_name" in params and not isinstance(params["query_target_name"], str):
        raise InvalidParameterError("Bad parameter: query_target_name must be an str")
    if "query_target_permission" in params and not isinstance(params["query_target_permission"], str):
        raise InvalidParameterError("Bad parameter: query_target_permission must be an str")
    if "query_target_user_id" in params and not isinstance(params["query_target_user_id"], str):
        raise InvalidParameterError("Bad parameter: query_target_user_id must be an str")
    if "query_target_username" in params and not isinstance(params["query_target_username"], str):
        raise InvalidParameterError("Bad parameter: query_target_username must be an str")
    if "query_target_platform" in params and not isinstance(params["query_target_platform"], str):
        raise InvalidParameterError("Bad parameter: query_target_platform must be an str")
    if "query_target_permission_set" in params and not isinstance(params["query_target_permission_set"], str):
        raise InvalidParameterError("Bad parameter: query_target_permission_set must be an str")
    response, options = Api.send_request("POST", "/history_exports", params, options)
    return HistoryExport(response.data, options)
Пример #21
0
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)
Пример #22
0
def resend_welcome_email(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 "id" not in params:
        raise MissingParameterError("Parameter missing: id")
    response, _options = Api.send_request(
        "POST", "/users/{id}/resend_welcome_email".format(id=params['id']),
        params, options)
    return response.data
Пример #23
0
    def delete(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")
        response, _options = Api.send_request("DELETE", "/projects/{id}".format(id=params['id']), params, self.options)
        return response.data
Пример #24
0
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)
Пример #25
0
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)
Пример #26
0
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)
Пример #27
0
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)
Пример #28
0
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
Пример #29
0
    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", "/styles/{path}".format(path=params['path']), params,
            self.options)
        return response.data
Пример #30
0
    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 "paths" in params and not isinstance(params["paths"], list):
            raise InvalidParameterError("Bad parameter: paths must be an list")
        if "password" in params and not isinstance(params["password"], str):
            raise InvalidParameterError(
                "Bad parameter: password must be an str")
        if "form_field_set_id" in params and not isinstance(
                params["form_field_set_id"], int):
            raise InvalidParameterError(
                "Bad parameter: form_field_set_id must be an int")
        if "clickwrap_id" in params and not isinstance(params["clickwrap_id"],
                                                       int):
            raise InvalidParameterError(
                "Bad parameter: clickwrap_id must be an int")
        if "code" in params and not isinstance(params["code"], str):
            raise InvalidParameterError("Bad parameter: code must be an str")
        if "description" in params and not isinstance(params["description"],
                                                      str):
            raise InvalidParameterError(
                "Bad parameter: description 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 "inbox_id" in params and not isinstance(params["inbox_id"], int):
            raise InvalidParameterError(
                "Bad parameter: inbox_id must be an int")
        if "max_uses" in params and not isinstance(params["max_uses"], int):
            raise InvalidParameterError(
                "Bad parameter: max_uses must be an int")
        if "note" in params and not isinstance(params["note"], str):
            raise InvalidParameterError("Bad parameter: note must be an str")
        response, _options = Api.send_request(
            "PATCH", "/bundles/{id}".format(id=params['id']), params,
            self.options)
        return response.data