Skip to content

Add custom recipe creation, editing and deletion API#179

Open
Mariosd23 wants to merge 18 commits into
miaucl:masterfrom
Mariosd23:main
Open

Add custom recipe creation, editing and deletion API#179
Mariosd23 wants to merge 18 commits into
miaucl:masterfrom
Mariosd23:main

Conversation

@Mariosd23

@Mariosd23 Mariosd23 commented Mar 25, 2026

Copy link
Copy Markdown

This PR adds the ability to create custom recipes from scratch (not just copy existing ones).

New Features

Custom Recipe API

  • create_custom_recipe() - Create new recipes from scratch with full details
  • edit_custom_recipe() - Edit existing custom recipes
  • get_custom_recipes() - List all custom recipes
  • remove_custom_recipe() - Delete custom recipes

Structured Step Settings

  • Support for CookidooInstruction with CookidooStepSettings (time, temperature, speed)
  • Allows guided cooking instructions with Thermomix presets

Usage Example

from cookidoo_api.types import CookidooCreateCustomRecipe

recipe = CookidooCreateCustomRecipe(
    name="My Recipe",
    ingredients=["100g flour", "2 eggs"],
    instructions=["Mix", "Bake"],
    serving_size=4,
    total_time=3600,
    active_time=1800,
    tools=["TM6"],
    unit_text="portion"
)
result = await api.create_custom_recipe(recipe)

Technical Details

  • Uses POST to create blank recipe, then PATCH to add full details
  • Ingredient format: {"type": "INGREDIENT", "text": "..."}
  • Step format: {"type": "STEP", "text": "..."}
  • unit_text must be exactly "portion"

Tests

  • Unit tests added to tests/test_cookidoo.py with proper mocked responses
  • Smoke tests consolidated into smoke_test/test_2_methods.py

All existing functionality remains unchanged. This only adds new capabilities.

@github-actions github-actions Bot added the 📖 documentation Improvements or additions to documentation label Mar 25, 2026
@miaucl miaucl self-requested a review April 1, 2026 15:52

@miaucl miaucl left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for helping out!
Please keep your SKILL.md in your own fork.
Also, I dont see any unit test coverage nor extension on the smoke tests. For a volatile library as this where we don't know when the API changes such things are essential.

…moke tests

- Remove SKILL.md from repo (keep in fork only per maintainer request)
- Add comprehensive unit tests in tests/test_edge_cases.py:
  * Config & localization tests (12 variants)
  * Auth edge cases (token expiry, invalid refresh)
  * Network resilience (5xx errors, timeouts)
  * API volatility protection (missing/extra fields)
  * Recipe CRUD with structured instructions
  * Calendar & shopping list edge cases
- Extend smoke tests in smoke_test/test_3_extended.py:
  * Full recipe lifecycle tests
  * Multi-day calendar operations
  * Complete shopping list workflow
  * Collection management (custom + managed)
  * Error handling scenarios

Total: 2,050+ lines of new test coverage
@github-actions github-actions Bot added the 🧪 testing Pull request that adds tests label Apr 1, 2026
@Mariosd23

Copy link
Copy Markdown
Author

Hi @miaucl,

Thank you for creating and maintaining this API

it's been incredibly useful!

I've addressed all the feedback:

Removed SKILL.md
Added comprehensive unit tests in tests/test_edge_cases.py
Extended smoke tests in smoke_test/test_3_extended.py
All checks are passing. Ready for your re-review when you have a moment!

@miaucl miaucl left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better :)

Please structure the unit tests and smoke tests better and "test_3_extended" is not a good name. There are some custom recipe tests in the test_edge_case which does not fit as well.

Comment thread cookidoo_api/types.py Outdated
@@ -1,5 +1,7 @@
"""Cookidoo API types."""

from __future__ import annotations

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed? until know, I had the type def without the need for future

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's not needed! I reordered the classes so CookidooStepSettings and CookidooInstruction are defined before CookidooCreateCustomRecipe and CookidooEditCustomRecipe, eliminating the forward reference. Removed the __future__ import.

Comment thread examples/create_recipe.py Outdated
active_time=30*60, # 30 minutes active prep
unit_text="portion", # IMPORTANT: Must be exactly "portion"
tools=["TM7", "TM6"], # Works with both TM7 and TM6 models
ingredients=[

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible to have the example in english? More people will be able to read it ;)

Comment thread tests/test_custom_recipes.py Outdated
assert result1.access_token == "test_token"


class TestRecipeOperations:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are not really edge cases, rather just unit tests for custom recipes, no?

Comment thread PR_RESPONSE.md Outdated

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file unneeded

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed!

@miaucl

miaucl commented Apr 2, 2026

Copy link
Copy Markdown
Owner

The file test_2_methods.py is getting pretty large, but all smoke tests should be in there for now.

@miaucl miaucl added the run smoke test Smoke test requires secrets, only run after review label Apr 2, 2026
@miaucl

miaucl commented Apr 2, 2026

Copy link
Copy Markdown
Owner

also, please run the linter and formatter before pushing, see readme for instrcutions

@miaucl miaucl left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess there is still some work to do in the testing :)

- Remove from __future__ import annotations from types.py
- Translate example recipe from Greek to English
- Rename test_edge_cases.py to test_custom_recipes.py
- Remove PR_RESPONSE.md
- Consolidate smoke tests into test_2_methods.py, remove test_3_extended.py
- Add examples/ to ruff per-file-ignores for T20
- Fix formatting and lint issues (ruff)
@facandiav

Copy link
Copy Markdown

@miaucl , is there a burner account to test hardware annotations on recipe creation? I pulled some rest transactions from my account and rev-engineered. Would be great to smoke test. - this would be another workstream

facandiav and others added 2 commits April 17, 2026 15:05
- Extract _format_instructions helper in helpers.py
- Move custom recipe unit tests into test_cookidoo.py with proper mocks
- Remove standalone test_custom_recipes.py and examples/create_recipe.py
- Fix type annotations in types.py
Move CookidooStepSettings and CookidooInstruction before
CookidooCreateCustomRecipe and CookidooEditCustomRecipe to eliminate
forward references, removing the need for __future__ annotations.
@Mariosd23 Mariosd23 changed the title Add custom recipe creation API and OpenClaw skill documentation Add custom recipe creation, editing and deletion API Apr 17, 2026
Send time, temperature, and speed as separate fields in the
instruction JSON payload so the Cookidoo app can render them
as formatted settings (like the mobile app does) instead of
plain text.
@miaucl

miaucl commented May 3, 2026

Copy link
Copy Markdown
Owner

@miaucl , is there a burner account to test hardware annotations on recipe creation? I pulled some rest transactions from my account and rev-engineered. Would be great to smoke test. - this would be another workstream

What do you mean with burner account? I already have set up accounts for different countries for the smoke tests. You can create easily test accounts for yourself if you need to test something. (Just need an new email ^^)

Or did I misunderstand you?

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

Labels

📖 documentation Improvements or additions to documentation run smoke test Smoke test requires secrets, only run after review 🧪 testing Pull request that adds tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants