zapier - Zapier StoreClient 未定义
问题描述
我正在尝试在类似于此处的文档的调用之间存储状态:https ://zapier.com/apps/code/help#code-examples
但是,我尝试从 Zap 运行代码,我得到:
StoreClient 未定义
文档指出我不需要任何东西来使用 StoreClient:“不需要它 - 它是在您的代码环境中预先导入的。”
我使用的是最新版本的 zapier-platform-core (8.3.0)。我正在使用上面链接的示例中的确切代码。
const count = await store.get('some counter')
const newCount = (count || 0) + 1;
await store.set('some counter', count);
return {count: newCount};
解决方案
大卫在这里,来自 Zapier 平台团队。好问题!
根据文档,这有点不清楚 -StoreClient
仅在 Code 应用程序(又名Code by Zapier
)中可用。如果您正在使用zapier-platform-core
,则您正在创建一个 cli 应用程序,它是一个 vanilla node.js 环境。如果您想从 cli 应用程序中进行交互Storage by Zapier
,您可以使用网站上的文档:https ://store.zapier.com 。即:
{
"how does it work?": {
"always provide either `?secret=12345` or `X-Secret: 12345`": "",
"GET /api/secret": [
"will return a random secret for you to use if you need one."
],
"GET /api/records": [
"will return a full object of all values stored by default.",
"you can also specify only the keys you want via the",
"querystring like`?key=color&key=age`."
],
"POST /api/records": [
"provide a body with a json object with keys/values you want",
"to store like `{\"color\": \"blue\", \"age\": 29}`."
],
"DELETE /api/records": ["completely clear all the records in this account"],
"PATCH /api/records": [
"A data with a particular schema needs to be received.",
"The schema specifies which action to do and with what parameters.",
"For example {\"action\": \"increment_by\", \"data\": {\"key\": \"<key_name>\", \"amount\": 1}} to increment the value specified by \"key\"."
]
}
}
可以使用标准向这些端点发出请求,该标准z.request
在此处有详细记录:https ://github.com/zapier/zapier-platform/tree/master/packages/cli#making-http-requests
推荐阅读
- dynamics-crm - Left Join fetchXml 基于公共列
- prism - RegionManager 没有正确注入
- react-native - React Native:不变违规:此导航器缺少导航道具
- python - 向二叉搜索树添加元素
- json - Azure Active Directory 自定义角色和可能的范围
- javascript - 访问对象内属性的兄弟姐妹,onclick javascript
- amazon-web-services - AWS 更改 ECS 服务任务定义(部署)而不使用 CloudFormation
- server - DNS BIND 区域传输错误:“连接失败:主机无法访问”
- azure - Azure Powershell - 跨 EA 中的多个订阅
- .net - WPF 自定义绑定刷新 RaisePropertyChange()