Skip to content

Commit c4d6864

Browse files
query_pdf_info: Default to all queries.
- Introduced `ALL_PDF_INFO_QUERIES` constant for predefined query sets. - Updated synchronous and asynchronous `query_pdf_info` methods to use `ALL_PDF_INFO_QUERIES` as the default value for `queries`. - Adjusted type definitions and imports accordingly. Assisted-by: Codex
1 parent 60cff20 commit c4d6864

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/pdfrest/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
TiffPdfRestPayload,
4646
UploadURLs,
4747
)
48-
from .types import PdfInfoQuery
48+
from .types import ALL_PDF_INFO_QUERIES, PdfInfoQuery
4949

5050
DEFAULT_BASE_URL = "https://api.pdfrest.com"
5151
API_KEY_ENV_VAR = "PDFREST_API_KEY"
@@ -1420,7 +1420,7 @@ def query_pdf_info(
14201420
self,
14211421
file: PdfRestFile | Sequence[PdfRestFile],
14221422
*,
1423-
queries: Sequence[PdfInfoQuery] | PdfInfoQuery,
1423+
queries: Sequence[PdfInfoQuery] | PdfInfoQuery = ALL_PDF_INFO_QUERIES,
14241424
extra_query: Query | None = None,
14251425
extra_headers: AnyMapping | None = None,
14261426
extra_body: Body | None = None,
@@ -1687,7 +1687,7 @@ async def query_pdf_info(
16871687
self,
16881688
file: PdfRestFile | Sequence[PdfRestFile],
16891689
*,
1690-
queries: Sequence[PdfInfoQuery] | PdfInfoQuery,
1690+
queries: Sequence[PdfInfoQuery] | PdfInfoQuery = ALL_PDF_INFO_QUERIES,
16911691
extra_query: Query | None = None,
16921692
extra_headers: AnyMapping | None = None,
16931693
extra_body: Body | None = None,

src/pdfrest/models/_validators.py

Whitespace-only changes.

src/pdfrest/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Public import surface for shared pdfrest types."""
22

3-
from .public import PdfInfoQuery
3+
from .public import ALL_PDF_INFO_QUERIES, PdfInfoQuery
44

5-
__all__ = ["PdfInfoQuery"]
5+
__all__ = ["ALL_PDF_INFO_QUERIES", "PdfInfoQuery"]

src/pdfrest/types/public.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from __future__ import annotations
44

5-
from typing import Literal
5+
from typing import Literal, cast, get_args
66

7-
__all__ = ("PdfInfoQuery",)
7+
__all__ = ("ALL_PDF_INFO_QUERIES", "PdfInfoQuery")
88

99
PdfInfoQuery = Literal[
1010
"tagged",
@@ -39,3 +39,7 @@
3939
"pdfx_claim",
4040
"requires_password_to_open",
4141
]
42+
43+
ALL_PDF_INFO_QUERIES: tuple[PdfInfoQuery, ...] = cast(
44+
tuple[PdfInfoQuery, ...], get_args(PdfInfoQuery)
45+
)

0 commit comments

Comments
 (0)