getRecipeList

版本要求:
@tuya-miniapp/cloud-api≥1.6.2

方法签名
getRecipeList(data: )

描述

分页查询符合条件的云食谱列表,支持按名称、产品、分类、烹饪时长、难度等筛选

参数

参数类型必填说明
是请求参数

返回值

类型:Promise<GetRecipeListResult>
GetRecipeListResult 食谱分页列表

引用对象

typeGetRecipeListResult分页查询云食谱列表结果
CloudRecipePage<CloudRecipeListItem>

合法值

CloudRecipeSearchParams.isFoodChannel
值说明最低版本
0否-
1是-
CloudRecipeSourceType
值说明最低版本
0B 端客户食谱(MENU)-
1C 端自定义食谱(DIY_MENU)-
2再应用食谱(APPLY_MENU)-
3GPT 食谱(GPT_MENU)-
4批量食谱(BATCH_MENU)-

示例代码

请求示例

import { getRecipeList } from '@tuya-miniapp/cloud-api';

getRecipeList({
  devId: 'your_device_id',
  pageNo: 1,
  pageSize: 20,
  name: '红烧肉',
  cookTimeMax: 3600,
})
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error('Failed to get recipe list:', error);
  });

返回示例

{
  "data": [
    {
      "id": 1001,
      "name": "西湖醋鱼",
      "desc": "杭州传统名菜,鱼肉鲜嫩,酸甜可口",
      "cookTime": 300,
      "cookType": 1,
      "easyLevel": "3481",
      "easyLevelDesc": "简单",
      "foodType": "3485",
      "taste": "3490",
      "mainImg": "https://example.com/recipe.jpeg",
      "mainImgs": ["https://example.com/recipe.jpeg"],
      "eatCount": 3,
      "isStar": false,
      "lang": 257,
      "langDesc": "zh-CN,en",
      "sourceType": 1,
      "productIds": ["your_product_id"]
    }
  ],
  "hasNext": false,
  "pageNo": 1,
  "pageSize": 20,
  "totalCount": 1
}