Repository navigation
fix: Add typed distribution hit share and top article helpers - #117
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by @drafty
🔴 Review tier: HIGH — human review required
What / why
Add
get_domain_hit_share()andget_top_n_articles_for_domains()toDistributionAPIandAsyncDistributionAPI, replacing the need for raw requests to these existing endpoints:GET /v1/distribution/stats/hit_share→HitShareResponseGET /v1/distribution/articles/top_n_for_domains→TopNArticlesForDomainResponseModels live in
asknews_sdk.dto.distribution; optional article IDs and pagination fields preserve the schema defaults. Query defaults, repeated domain parameters, all three ranking metrics, date filters and custom headers follow existing client conventions. Numeric limits remain server-validated, as in neighboring helpers.Contract checked on 2026-10-26 against production OpenAPI 0.32.7 and the committed
asknews-sdk/openapi.json(API info version 0.32.3). The two endpoints' parameters and all four relevant response schemas are identical. The dev gateway also reports 0.32.7 with identical targeted contracts: compared to the committed spec, 0 operations added/removed and 0 schemas added/removed. No spec files, versions, changelogs or workflows changed.How I tested
uv.lock, Python 3.11.taskis not installed):ruff check asknews_sdk;coverage run -m pytest --junitxml=report.xml;coverage report;coverage xml;coverage html -d coverage-report— 169 tests passed.ruff format --check asknews_sdk/api/distribution.py asknews_sdk/dto/distribution.pyandgit diff --checkpassed.mypy --follow-imports=silent asknews_sdk/api/distribution.py asknews_sdk/dto/distribution.pypassed.mypy asknews_sdkreports 3 existing errors in unchangeddto/chat.pyandapi/wiki.py; no distribution errors. The repository CI uses lint/tests, not mypy.Risk / rollback
Additive methods only; existing methods and client serialization are unchanged. No live authenticated calls or production actions. Merging publishes a new release to PyPI. Revert via a follow-up reviewed release if needed. Keep the
fix:PR/squash title so release automation selects the change; repository squash-title settings preserve the commit or PR title. No merge, tag, publish or release performed by this change author.