Webhook

不同类型网络钩子的元数据。如果您使用的是 inlineCloudFunction,则源代码必须位于与 executeFunction 键的值相同的目录中。例如,如果 executeFunction 键的值为 my_webhook,代码结构将如下所示:- /webhooks/my_webhook.yaml - /webhooks/my_webhook/index.js - /webhooks/my_webhook/package.json

YAML 表示法
handlers: 
  - object (Handler)

# Union field webhook_type can be only one of the following:
httpsEndpoint: 
  object (HttpsEndpoint)
inlineCloudFunction: 
  object (InlineCloudFunction)
# End of list of possible types for union field webhook_type.
字段
handlers[]

object (Handler)

此 webhook 的处理程序列表。

联合字段 webhook_type。系统仅支持一种 webhook 类型。webhook_type 只能是下列其中一项:
httpsEndpoint

object (HttpsEndpoint)

自定义 webhook HTTPS 端点。

inlineCloudFunction

object (InlineCloudFunction)

通过 webhook 文件夹中的代码部署的 Cloud Functions 函数的元数据。

Handler

声明 webhoook 处理程序的名称。一个 webhook 可以注册多个处理程序。您可以从 Actions 项目中的多个位置调用这些处理程序。

YAML 表示法
name: string
字段
name

string

必需。处理程序的名称。在 Actions 项目的所有处理程序中必须是唯一的。您可以查看此处理程序的名称,以调用执行方式源代码中的正确函数。

HttpsEndpoint

REST 端点,用于在您未使用内嵌编辑器时发送通知。

YAML 表示法
baseUrl: string
httpHeaders: 
  string: string
endpointApiVersion: integer
字段
baseUrl

string

执行方式端点的 HTTPS 基准网址(不支持 HTTP)。处理程序名称会附加到基准网址路径中的冒号后(遵循 https://cloud.google.com/apis/design/custom_methods) 中的样式指南)。例如,基准网址“https://gactions.service.com/api”将收到包含网址“https://gactions.service.com/api:{method}”的请求。

httpHeaders

map (key: string, value: string)

要包含在 POST 请求中的 HTTP 参数的映射。

包含一系列 "key": value 对的对象。示例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }

endpointApiVersion

integer

端点使用的协议的版本。这是所有执行方式类型共享的协议,并非特定于 Google 执行方式类型。

InlineCloudFunction

保存从 webhooks 文件夹部署的内嵌 Cloud Functions 函数的元数据。

YAML 表示法
executeFunction: string
字段
executeFunction

string

Cloud Functions 函数入口点的名称。此字段的值应与从源代码中导出的方法的名称一致。