Skip to content

refactor: type query parameters with a shared QueryParams alias - #1164

Draft
Pijukatel wants to merge 1 commit into
masterfrom
claude/exciting-bohr-3acq8b
Draft

Pijukatel wants to merge 1 commit into
masterfrom
claude/exciting-bohr-3acq8b

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
  • Adds QueryParamValue and QueryParams to apify_client.types and uses them for every params input in the client (HttpClient.call, _build_params, default params, wait and batch helpers), generalizing the inline type from feat: add Server Actor support to Actor clients #1153.
  • The union is exactly what the client converts or sends unchanged (str, int, float, bool, Decimal, datetime, list[str], None); a list of non-strings raised TypeError, and a timedelta, tuple, enum or dict was sent as its repr, so both are now type errors.
  • Custom HTTP clients overriding call with params: dict[str, Any] | None should accept QueryParams | None; runtime behavior is unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PMV1XJr6EmKKzmbe8tYp7C

Add `QueryParamValue` and `QueryParams` to `apify_client.types` and use them for every query-parameter input in
the client: `HttpClient.call`, `HttpClientAsync.call`, `_prepare_request_call`, `_parse_params`, the resource
client's default params, `_build_params`, `_build_public_url`, and the wait-for-finish and batch-add helpers.

The value union lists exactly what the client converts or sends unchanged: `str`, `int`, `float`, `bool`,
`Decimal`, `datetime`, `list[str]`, and `None`. A list of non-strings raised a `TypeError` in the comma join,
and any other value, such as a `timedelta`, a tuple or an enum, was sent as its `str()`; both are now type errors.
`Decimal` is included because `max_total_charge_usd` is passed as one. The alias is a `Mapping` so a
`dict[str, str]` or `dict[str, int]` is accepted without a cast.

Custom HTTP clients that override `call` with `params: dict[str, Any] | None` now fail the override check in a
type checker and should accept `QueryParams | None`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PMV1XJr6EmKKzmbe8tYp7C
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.45%. Comparing base (9f9b98a) to head (7d9bcba).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/apify_client/types.py 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1164      +/-   ##
==========================================
- Coverage   95.53%   95.45%   -0.08%     
==========================================
  Files          61       61              
  Lines        5982     5987       +5     
==========================================
  Hits         5715     5715              
- Misses        267      272       +5     
Flag Coverage Δ
integration 90.66% <40.00%> (-0.08%) ⬇️
unit 89.72% <40.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants