webhook method

Future<ReceiveTriggerWebhookResponse> webhook(
  1. HttpBody request,
  2. String name, {
  3. String? projectId,
  4. String? secret,
  5. String? trigger,
  6. String? $fields,
})

ReceiveTriggerWebhook [Experimental] is called when the API receives a webhook request targeted at a specific trigger.

request - The metadata request object.

Request parameters:

name - The name of the ReceiveTriggerWebhook to retrieve. Format: projects/{project}/locations/{location}/triggers/{trigger} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/triggers/\[^/\]+$.

projectId - Project in which the specified trigger lives

secret - Secret token used for authorization if an OAuth token isn't provided.

trigger - Name of the trigger to run the payload against

$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 name, {
  core.String? projectId,
  core.String? secret,
  core.String? trigger,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (projectId != null) 'projectId': [projectId],
    if (secret != null) 'secret': [secret],
    if (trigger != null) 'trigger': [trigger],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':webhook';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return ReceiveTriggerWebhookResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}