run method
- RepoSource request,
- String projectId,
- String triggerId, {
- String? name,
- String? $fields,
Runs a BuildTrigger
at a particular source revision.
To run a regional or global trigger, use the POST request that includes the location endpoint in the path (ex. v1/projects/{projectId}/locations/{region}/triggers/{triggerId}:run). The POST request that does not include the location endpoint in the path can only be used when running global triggers.
request
- The metadata request object.
Request parameters:
projectId
- Required. ID of the project.
triggerId
- Required. ID of the trigger.
name
- The name of the Trigger
to run. Format:
projects/{project}/locations/{location}/triggers/{trigger}
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Operation.
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<Operation> run(
RepoSource request,
core.String projectId,
core.String triggerId, {
core.String? name,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (name != null) 'name': [name],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/projects/' +
commons.escapeVariable('$projectId') +
'/triggers/' +
commons.escapeVariable('$triggerId') +
':run';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}