#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
# AUTO-GENERATED FILE. DO NOT EDIT.
# Generated by scripts/generate_tool_models.py from the Java OpenAPI spec (SwaggerDoc.json).
# Regenerate with: task engine:tool-models
"""What each tool endpoint accepts and produces, so a planned chain can be checked before it
is run. Declared in Java with ``@ToolIO``; see ``stirling.services.tool_io_compat`` for the
compatibility rules that read this table."""
from enum import StrEnum
from pydantic import Field
from stirling.models.base import ApiModel
from stirling.models.tool_models import ToolEndpoint
class ToolFormat(StrEnum):
"""The kind of file a tool consumes or produces. ``ANY`` accepts or produces anything;
``NONE`` means no file at all, such as a report or a status."""
PDF = "PDF"
PDF_ENCRYPTED = "PDF_ENCRYPTED"
IMAGE = "IMAGE"
ZIP = "ZIP"
WORD = "WORD"
PPT = "PPT"
EXCEL = "EXCEL"
CSV = "CSV"
HTML = "HTML"
XML = "XML"
JSON = "JSON"
TEXT = "TEXT"
MARKDOWN = "MARKDOWN"
JAVASCRIPT = "JAVASCRIPT"
EBOOK = "EBOOK"
EMAIL = "EMAIL"
VIDEO = "VIDEO"
CBZ = "CBZ"
CBR = "CBR"
ANY = "ANY"
NONE = "NONE"
class ToolArity(StrEnum):
"""How many files go in and come out (Single/Multiple In, Single/Multiple Out). A
multi-output tool returns its results zipped, and the caller unpacks them."""
SISO = "SISO"
SIMO = "SIMO"
MISO = "MISO"
MIMO = "MIMO"
class ToolIOWhen(ApiModel):
"""One condition on a request parameter, guarding a :class:`ToolIOCase`."""
param: str
matches: list[str]
# The value the endpoint uses when this parameter is absent; None when it has none.
default: str | None = None
class ToolIOCase(ApiModel):
"""An output that applies when every condition in ``when`` holds."""
when: list[ToolIOWhen]
produces: ToolFormat
arity: ToolArity
class ToolIOSpec(ApiModel):
"""What one endpoint accepts and produces."""
accepts: list[ToolFormat]
produces: ToolFormat
arity: ToolArity
cases: list[ToolIOCase] = Field(default_factory=list)
TOOL_IO: dict[ToolEndpoint, ToolIOSpec] = {
ToolEndpoint.CBR_TO_PDF: ToolIOSpec(accepts=[ToolFormat.CBR], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.CBZ_TO_PDF: ToolIOSpec(accepts=[ToolFormat.CBZ], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.EBOOK_TO_PDF: ToolIOSpec(accepts=[ToolFormat.EBOOK], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.EML_TO_PDF: ToolIOSpec(accepts=[ToolFormat.EMAIL], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.FILE_TO_PDF: ToolIOSpec(accepts=[ToolFormat.ANY], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.HTML_TO_PDF: ToolIOSpec(
accepts=[ToolFormat.HTML, ToolFormat.ZIP], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.IMG_TO_PDF: ToolIOSpec(accepts=[ToolFormat.IMAGE], produces=ToolFormat.PDF, arity=ToolArity.MISO),
ToolEndpoint.MARKDOWN_TO_PDF: ToolIOSpec(
accepts=[ToolFormat.MARKDOWN, ToolFormat.ZIP], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.PDF_TO_CBR: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.CBR, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_CBZ: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.CBZ, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_CSV: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.CSV, arity=ToolArity.SIMO),
ToolEndpoint.PDF_TO_EPUB: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.EBOOK, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_HTML: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.ZIP, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_IMG: ToolIOSpec(
accepts=[ToolFormat.PDF],
produces=ToolFormat.IMAGE,
arity=ToolArity.SIMO,
cases=[
ToolIOCase(
when=[ToolIOWhen(param="singleOrMultiple", matches=["single"], default="multiple")],
produces=ToolFormat.IMAGE,
arity=ToolArity.SISO,
)
],
),
ToolEndpoint.PDF_TO_MARKDOWN: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.MARKDOWN, arity=ToolArity.SISO
),
ToolEndpoint.PDF_TO_PDFA: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_PRESENTATION: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PPT, arity=ToolArity.SISO
),
ToolEndpoint.PDF_TO_TEXT: ToolIOSpec(
accepts=[ToolFormat.PDF],
produces=ToolFormat.TEXT,
arity=ToolArity.SISO,
cases=[
ToolIOCase(
when=[ToolIOWhen(param="outputFormat", matches=["rtf"])], produces=ToolFormat.WORD, arity=ToolArity.SISO
)
],
),
ToolEndpoint.PDF_TO_UA: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_WORD: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.WORD, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_XLSX: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.EXCEL, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_XML: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.XML, arity=ToolArity.SISO),
ToolEndpoint.SVG_TO_PDF: ToolIOSpec(
accepts=[ToolFormat.IMAGE],
produces=ToolFormat.PDF,
arity=ToolArity.MIMO,
cases=[
ToolIOCase(
when=[ToolIOWhen(param="combineIntoSinglePdf", matches=["true"], default="false")],
produces=ToolFormat.PDF,
arity=ToolArity.MISO,
)
],
),
ToolEndpoint.URL_TO_PDF: ToolIOSpec(accepts=[ToolFormat.NONE], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.BOOKLET_IMPOSITION: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.CROP: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.EDIT_TABLE_OF_CONTENTS: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.MERGE_PDFS: ToolIOSpec(
accepts=[ToolFormat.PDF, ToolFormat.IMAGE], produces=ToolFormat.PDF, arity=ToolArity.MISO
),
ToolEndpoint.MULTI_PAGE_LAYOUT: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.PDF_TO_SINGLE_PAGE: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.REARRANGE_PAGES: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REMOVE_IMAGE_PDF: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REMOVE_PAGES: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.ROTATE_PDF: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.SCALE_PAGES: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.SPLIT_BY_SIZE_OR_COUNT: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO
),
ToolEndpoint.SPLIT_FOR_POSTER_PRINT: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO
),
ToolEndpoint.SPLIT_PAGES: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO),
ToolEndpoint.SPLIT_PDF_BY_CHAPTERS: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO
),
ToolEndpoint.SPLIT_PDF_BY_SECTIONS: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO
),
ToolEndpoint.ADD_COMMENTS: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.ADD_PAGE_NUMBERS: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.ADD_STAMP: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.AUTO_RENAME: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.AUTO_ROTATE_PDF: ToolIOSpec(
accepts=[ToolFormat.PDF],
produces=ToolFormat.PDF,
arity=ToolArity.SISO,
cases=[
ToolIOCase(
when=[ToolIOWhen(param="dryRun", matches=["true"], default="false")],
produces=ToolFormat.JSON,
arity=ToolArity.SISO,
)
],
),
ToolEndpoint.AUTO_SPLIT_PDF: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO),
ToolEndpoint.BATCH_PROCESS_ATTACHMENTS: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.COMPRESS_PDF: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.CREATE_PORTFOLIO: ToolIOSpec(accepts=[ToolFormat.ANY], produces=ToolFormat.PDF, arity=ToolArity.MISO),
ToolEndpoint.DELETE_ATTACHMENT: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.EXTRACT_ATTACHMENTS: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.ZIP, arity=ToolArity.SISO
),
ToolEndpoint.EXTRACT_IMAGE_SCANS: ToolIOSpec(
accepts=[ToolFormat.PDF, ToolFormat.IMAGE], produces=ToolFormat.IMAGE, arity=ToolArity.SIMO
),
ToolEndpoint.EXTRACT_IMAGES: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.IMAGE, arity=ToolArity.SIMO),
ToolEndpoint.EXTRACT_SINGLE_ATTACHMENT: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.ANY, arity=ToolArity.SISO
),
ToolEndpoint.FLATTEN: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.FLATTEN_PORTFOLIO: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.OCR_PDF: ToolIOSpec(
accepts=[ToolFormat.PDF],
produces=ToolFormat.PDF,
arity=ToolArity.SISO,
cases=[
ToolIOCase(
when=[ToolIOWhen(param="sidecar", matches=["true"], default="false")],
produces=ToolFormat.ZIP,
arity=ToolArity.SISO,
)
],
),
ToolEndpoint.REMOVE_BLANKS: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SIMO),
ToolEndpoint.RENAME_ATTACHMENT: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REPAIR: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REPLACE_INVERT_PDF: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO
),
ToolEndpoint.SCANNER_EFFECT: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.UNLOCK_PDF_FORMS: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.UPDATE_METADATA: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.ACCESSIBILITY_REPORT: ToolIOSpec(
accepts=[ToolFormat.PDF], produces=ToolFormat.JSON, arity=ToolArity.SISO
),
ToolEndpoint.ADD_PASSWORD: ToolIOSpec(
accepts=[ToolFormat.PDF, ToolFormat.PDF_ENCRYPTED],
produces=ToolFormat.PDF_ENCRYPTED,
arity=ToolArity.SISO,
cases=[
ToolIOCase(
when=[
ToolIOWhen(param="password", matches=[""], default=""),
ToolIOWhen(param="ownerPassword", matches=[""], default=""),
ToolIOWhen(param="preserveExisting", matches=["false"], default="false"),
],
produces=ToolFormat.PDF,
arity=ToolArity.SISO,
)
],
),
ToolEndpoint.ADD_WATERMARK: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.AUTO_REDACT: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REDACT: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REDACT_EXECUTE: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REMOVE_CERT_SIGN: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.REMOVE_PASSWORD: ToolIOSpec(
accepts=[ToolFormat.PDF, ToolFormat.PDF_ENCRYPTED],
produces=ToolFormat.PDF,
arity=ToolArity.SISO,
cases=[
ToolIOCase(
when=[ToolIOWhen(param="password", matches=[""], default="")],
produces=ToolFormat.ANY,
arity=ToolArity.SISO,
)
],
),
ToolEndpoint.SANITIZE_PDF: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
ToolEndpoint.TIMESTAMP_PDF: ToolIOSpec(accepts=[ToolFormat.PDF], produces=ToolFormat.PDF, arity=ToolArity.SISO),
}