readFile method

Future<ReadFileResponse> readFile(
  1. String workspace, {
  2. String? path,
  3. String? revision,
  4. String? $fields,
})

Returns the contents of a file (inside a Workspace).

Request parameters:

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

path - Required. The file's full path including filename, relative to the workspace root.

revision - Optional. The Git revision of the file to return. If left empty, the current contents of path will be returned.

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

Completes with a ReadFileResponse.

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<ReadFileResponse> readFile(
  core.String workspace, {
  core.String? path,
  core.String? revision,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'path': ?path == null ? null : [path],
    'revision': ?revision == null ? null : [revision],
    'fields': ?$fields == null ? null : [$fields],
  };

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

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