def _create_schema(id_: str, schema_content: SchemaContent, rossum: RossumClient, name: Optional[str]) -> None: original_schema = get_json(rossum.get(f"schemas/{id_}")) new_schema = rossum.create_schema(name or original_schema["name"], schema_content) for queue_url in original_schema["queues"]: if queue_url.startswith(rossum.url): queue_url = queue_url[len(rossum.url) + 1:] rossum.patch(queue_url, data={"schema": new_schema["url"]})
def _patch_inbox(rossum: RossumClient, queue_dict: dict, email_prefix: Optional[str], bounce_email: Optional[str]) -> dict: inbox_data: Dict[str, Any] = {} if email_prefix: inbox_data["email_prefix"] = email_prefix if bounce_email: inbox_data["bounce_email_to"] = bounce_email inbox_data["bounce_unprocessable_attachments"] = True _, inbox_id = queue_dict["inbox"].rsplit("/", 1) return get_json(rossum.patch(f"inboxes/{inbox_id}", inbox_data))
def _rewrite_schema(id_: str, schema_content: SchemaContent, rossum: RossumClient, name: Optional[str]) -> None: data: Schema = {"content": schema_content} if name is not None: data["name"] = name rossum.patch(f"schemas/{id_}", data=data)