webhook method
ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.
request
- The metadata request object.
Request parameters:
projectId
- Project in which the specified trigger lives
trigger
- Name of the trigger to run the payload against
name
- The name of the ReceiveTriggerWebhook
to retrieve. Format:
projects/{project}/locations/{location}/triggers/{trigger}
secret
- Secret token used for authorization if an OAuth token isn't
provided.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ReceiveTriggerWebhookResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http_1.Client
completes with an error when making a REST
call, this method will complete with the same error.
Implementation
async.Future<ReceiveTriggerWebhookResponse> webhook(
HttpBody request,
core.String projectId,
core.String trigger, {
core.String? name,
core.String? secret,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (name != null) 'name': [name],
if (secret != null) 'secret': [secret],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/projects/' +
commons.escapeVariable('$projectId') +
'/triggers/' +
commons.escapeVariable('$trigger') +
':webhook';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return ReceiveTriggerWebhookResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}