fetchGitAheadBehind method

Future<FetchGitAheadBehindResponse> fetchGitAheadBehind(
  1. String name, {
  2. String? remoteBranch,
  3. String? $fields,
})

Fetches Git ahead/behind against a remote branch.

Request parameters:

name - Required. The workspace's name. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/repositories/\[^/\]+/workspaces/\[^/\]+$.

remoteBranch - Optional. The name of the branch in the Git remote against which this workspace should be compared. If left unset, the repository's default branch name will be used.

$fields - Selector specifying which fields to include in a partial response.

Completes with a FetchGitAheadBehindResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<FetchGitAheadBehindResponse> fetchGitAheadBehind(
  core.String name, {
  core.String? remoteBranch,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'remoteBranch': ?remoteBranch == null ? null : [remoteBranch],
    'fields': ?$fields == null ? null : [$fields],
  };

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

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