Recipe Swap Options

Retrieves similar recipes for meal plan swaps

Use the recipeSwapOptions query to retrieve "similar" and "on plan" recipes given a recipeId.

This query is commonly used to provide alternatives for swapping recipes on a meal plan with similar macronutrients.

The serving argument can be used with the numOfServings field from a mealPlan response to find alternative recipes with a similar amount of macronutrients.

Recipes in the response have also a serving field to know how many of the total numbers of servings have to be served to keep a similar amount of macros.

If you already have a meal from a mealPlan query, you can use the serving argument to find more recipes. The recipes in the response will also have a serving field to know how many of the total numbers of servings have to be served to keep a similar amount of macros.

Available Arguments

Argument

Required

Type

Description

recipeId

True

ID

Original recipe ID.

serving

False

Int

The number of recipe servings served. Default to 1.

Available Fields

Field Name

Type

Description

onPlan

Object that retrieves other meals in the existing meal plan for the same mealTime. If the size parameter is not defined, 6 onPlan recipes are returned

similar

It retrieves all the recipes different than the original but similar in macros. If the size parameter is not defined, 3 similar recipes are returned.

Please note that recipeSwapOptions won't work for a user that doesn't have an active meal plan.

Example

The following example retrieves similar and onPlan recipes.

{
  recipeSwapOptions(
    recipeId: "UmVjaXBlOjZkNGZkMjY1LWRmYWItNDJmMS1iMWIxLTJmMjk0ZTFlNGFmNw=="
    serving: 1
  ) {
    similar {
      id
      databaseId
      name
      mealTags
      serving
      numberOfServings
    }
    onPlan {
      id
      databaseId
      name
      mealTags
      serving
      numberOfServings
    }
  }
}

The following example retrieves 2 similar recipes and 5 onPlan recipes

{
  recipeSwapOptions(
    recipeId: "UmVjaXBlOjdmZTZkNWZkLTBhNmMtNGFhMC1hYmJhLWE2N2Y5NTg1NzEwZQ=="

  ) {
    similar (size:2) {
      id
      databaseId
      name
      mealTags
      serving
      numberOfServings
    }
    onPlan (size:5) {
      id
      databaseId
      name
      mealTags
      serving
      numberOfServings
      
    }
  }
}

Last updated