getCodeTree method

Future<RepoTree?> getCodeTree({
  1. String? repo,
})

Returns one repository's file structure with a per-file symbol count — get_repo_structure over the org's own index, with no git checkout involved.

Returns one repository's file structure with a per-file symbol count — get_repo_structure over the org's own index, with no git checkout involved. A repository that has not been indexed answers an empty tree rather than an error, so an agent can tell "nothing here" without handling a failure.

Parameters:

  • String repo: Repo is the repository to walk. REQUIRED — a tree is repo-scoped.

Implementation

Future<RepoTree?> getCodeTree({ String? repo, }) async {
  final response = await getCodeTreeWithHttpInfo( 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), 'RepoTree',) as RepoTree;

  }
  return null;
}