Recipes resource
GET/POST /v1/recipes and related endpoints. foodapi.resources.recipes.RecipesResource ¶ RecipesResource(transport: Any) Bases: BaseResource Recipe discovery,…
PythonTypeScript
GET/POST /v1/recipes and related endpoints.
foodapi.resources.recipes.RecipesResource
¶
Bases: BaseResource
Recipe discovery, import, and transformation helpers.
list
¶
list(
*,
search: str | None = None,
cuisine: str | None = None,
category: str | None = None,
meal_type: str | None = None,
protein: str | None = None,
favorites_only: bool | None = None,
has_variants: bool | None = None,
has_relationships: bool | None = None,
include_shared: bool = True,
include_global: bool = True,
include_owned: bool = True,
owned_only: bool = False,
shared_only: bool = False,
global_only: bool = False,
limit: int = 20,
offset: int = 0
) -> RecipeListResponse
Paginated recipe discovery list (GET /v1/recipes).
search
¶
search(
*,
search: str | None = None,
has_variants: bool | None = None,
has_relationships: bool | None = None,
limit: int = 20,
offset: int = 0
) -> RecipeListResponse
Alias for :meth:list (backward compatible).
mine
¶
mine(
*,
search: str | None = None,
limit: int = 20,
offset: int = 0
) -> RecipeListResponse
List recipes owned by the authenticated developer.
shared
¶
shared(
*,
search: str | None = None,
limit: int = 20,
offset: int = 0
) -> RecipeListResponse
List PUBLIC recipes from other developers.
catalog
¶
catalog(
*,
search: str | None = None,
limit: int = 20,
offset: int = 0
) -> RecipeListResponse
Read-only global recipe corpus.
transform
¶
transform(
recipe_id: str | UUID,
transformation_type: TransformationType | str,
) -> TransformationResponse
Propose a deterministic transformation (POST /v1/recipes/{id}/transform).
The response includes a structured summary with per-operation
changes, warnings, and aggregate confidence. Not persisted.
foodapi.resources.recipes.AsyncRecipesResource
¶
Bases: BaseResource
transform
async
¶
transform(
recipe_id: str | UUID,
transformation_type: TransformationType | str,
) -> TransformationResponse
Propose a deterministic transformation (POST /v1/recipes/{id}/transform).
Example
recipe = client.recipes.get("550e8400-e29b-41d4-a716-446655440000")
page = client.recipes.list(search="tacos", limit=10)
imported = client.recipes.import_url("https://example.com/recipe")
# Build copy indexes from list items — no per-recipe detail fetches required
copies_by_source = {
item.copied_from_recipe_id: item.id
for item in page.items
if item.copied_from_recipe_id is not None
}
# Deterministic transformation with a structured summary (not persisted)
result = client.recipes.transform(recipe.id, "VEGAN")
if result.summary is not None:
print(result.summary.title, result.summary.confidence)
for change in result.summary.changes:
print(change.action, change.reason_code, change.reason)
for warning in result.summary.warnings:
print(warning.severity, warning.code, warning.message)