fetchCommit method

Future<FetchGitRepositoryLinkCommitResponse> fetchCommit(
  1. String name, {
  2. String? commitSha,
  3. List<String>? pathFilters,
  4. String? view,
  5. String? $fields,
})

Fetch Commit details from a Git repository link.

Request parameters:

name - Required. The resource name of the GitRepositoryLink in the format `projects / * /locations / * /connections / * /gitRepositoryLinks /

  • . Value must have pattern ^projects/[^/]+/locations/[^/]+/connections/[^/]+/gitRepositoryLinks/[^/]+$`.

commitSha - Required. The commit SHA, or symbolic revision (for example, branch name, tag, or Git reference).

pathFilters - Optional. Path patterns or exact paths to filter returned files (only applicable in FULL view). When path_filters is specified, FileDiff.patch is populated for all matching files (use ["**"] to include patches for all changed files). When path_filters is omitted or empty, the full list of FileDiff is returned without patch diffs (FileDiff.patch is empty).

view - Optional. The level of commit details to return in the response. Defaults to FULL if unspecified. In FULL view, files metadata (paths and statuses) are returned; path_filters must also be specified to populate line patch hunks. Possible string values are:

  • "COMMIT_VIEW_UNSPECIFIED" : Unspecified, defaults to BASIC.
  • "BASIC" : Basic view, returns commit metadata but no file diffs.
  • "FULL" : Full view, returns commit metadata and file diffs.

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

Completes with a FetchGitRepositoryLinkCommitResponse.

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<FetchGitRepositoryLinkCommitResponse> fetchCommit(
  core.String name, {
  core.String? commitSha,
  core.List<core.String>? pathFilters,
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'commitSha': ?commitSha == null ? null : [commitSha],
    'pathFilters': ?pathFilters,
    'view': ?view == null ? null : [view],
    'fields': ?$fields == null ? null : [$fields],
  };

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

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