David 来自 Zapier 平台团队。好问题!
根据文档,这有点不清楚 - StoreClient 仅在代码应用程序中可用(又名 Code by Zapier)。如果您使用zapier-platform-core,则您正在创建一个cli 应用程序,它是一个普通的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