Skip to content

Add custom recipes listing API#222

Open
Dragons0458 wants to merge 1 commit into
miaucl:masterfrom
Dragons0458:feature/list-custom-recipes
Open

Add custom recipes listing API#222
Dragons0458 wants to merge 1 commit into
miaucl:masterfrom
Dragons0458:feature/list-custom-recipes

Conversation

@Dragons0458

@Dragons0458 Dragons0458 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Context

Cookidoo exposes methods to fetch and manage individual custom recipes, but the client does not currently provide a way to retrieve the user's complete custom recipe list.

The custom recipe listing endpoint also returns recipe content in a slightly different shape from the individual recipe endpoint, so the existing parser needs to understand both representations.

Objective

The goal of this PR is to add a focused list_custom_recipes() API while preserving the behavior of the existing custom recipe methods.

What changed

List custom recipes

  • Added list_custom_recipes() to retrieve all custom recipes from created-recipes/{language}.
  • Added the custom recipe collection media type required by the listing endpoint.
  • Routed the request through the shared _request_json helper so authorization failures, request errors, timeouts, malformed responses, and JSON parsing remain consistent with the rest of the client.
  • Added response-shape validation before parsing the returned items.

List response parsing

  • Added typed structures for the custom recipe list response and its text items.
  • Updated the existing custom recipe parser to support the field names returned by the list endpoint:
    • numeric or ISO-8601 durations
    • tool or tools
    • recipeYield or yield
    • recipeIngredient or ingredients
    • recipeInstructions or instructions
  • Normalized ingredient and instruction objects containing text into the existing list[str] public representation.
  • Added safe zero defaults when optional times or yield data are missing.
  • Kept the parser fully typed without introducing Any.

Tests

  • Added unit tests for successful listing, empty lists, authorization failures, request exceptions, and malformed responses.
  • Added parser coverage for the custom recipe list response format.
  • Added a read-only smoke test against the real Cookidoo listing endpoint.

Behavioral notes

  • This PR only adds custom recipe listing support. It does not add custom recipe creation or editing APIs.
  • list_custom_recipes() returns list[CookidooCustomRecipe].
  • Existing individual custom recipe methods retain their current behavior.
  • The public CookidooCustomRecipe representation remains unchanged.

Validation

  • .venv/bin/python -m pytest -q --cov-config=pyproject.toml --cov=cookidoo_api --cov-branch --cov-report=term-missing --cov-fail-under=100
    • 270 passed
    • statements: 849/849
    • branches: 112/112
    • total coverage: 100.00%
  • .venv/bin/python -m pytest -q smoke_test/test_2_methods.py::TestMethods::test_cookidoo_list_custom_recipes
    • 1 passed against the real Cookidoo endpoint
  • .venv/bin/python -m ruff check .
  • .venv/bin/python -m mypy cookidoo_api

@github-actions github-actions Bot added the 🧪 testing Pull request that adds tests label Jun 9, 2026
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d7fd1fa) to head (d17ea88).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #222   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          833       849   +16     
  Branches        53        56    +3     
=========================================
+ Hits           833       849   +16     

☔ 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.

@Dragons0458 Dragons0458 force-pushed the feature/list-custom-recipes branch from 7b56436 to 7e2018a Compare June 9, 2026 02:33
@Dragons0458 Dragons0458 changed the title Add custom recipe creation, listing, and parsing support Add custom recipes listing API Jun 9, 2026
@Dragons0458 Dragons0458 force-pushed the feature/list-custom-recipes branch from 7e2018a to 88d3b59 Compare June 9, 2026 02:35
@Dragons0458 Dragons0458 force-pushed the feature/list-custom-recipes branch from 88d3b59 to d17ea88 Compare June 9, 2026 02:41
@Dragons0458 Dragons0458 marked this pull request as ready for review June 9, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧪 testing Pull request that adds tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant