getCodeFile method

Future<FileContent?> getCodeFile({
  1. String? pathParam,
  2. String? repo,
})

Returns the INDEXED content of one file — read_file over the chunks the search tiers hold, for pulling up code an agent just found.

Returns the INDEXED content of one file — read_file over the chunks the search tiers hold, for pulling up code an agent just found. It is NOT byte-verbatim: the git object plane is the source of record for exact bytes, history and blame. A file absent from the index is a 404, so an agent can tell "not indexed" from "empty file".

Parameters:

  • String pathParam: Path is the file's repo-relative path. Required.

  • String repo: Repo is the repository the file belongs to. REQUIRED.

Implementation

Future<FileContent?> getCodeFile({ String? pathParam, String? repo, }) async {
  final response = await getCodeFileWithHttpInfo( pathParam: pathParam, repo: repo, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FileContent',) as FileContent;

  }
  return null;
}