treeAsFlow

fun GithubApi.treeAsFlow(repositoryName: String, fileExtensions: List<String> = emptyList(), skipFolders: List<String> = emptyList(), sha: String? = null, concurrency: Int = 100): Flow<TreeRef.TreeEntry>

Retrieves a flow of tree entries for the specified GitHub repository, filtered by file extensions and skipped folders.

Return

A Flow<TreeRef.TreeEntry> object representing the tree entries matching the specified criteria.

Example usage:

val githubApi = GithubApi("your_api_key_here")
val repositoryName = "owner/repo_name"
val fileExtensions = listOf("java", "kt")
val skipFolders = listOf("test", "samples")
val treeFlow = githubApi.treeAsFlow(
repositoryName,
fileExtensions,
skipFolders
)
treeFlow.collect { println(it) }

Parameters

repositoryName

The name of the GitHub repository.

fileExtensions

A list of file extensions to filter the tree entries by.

skipFolders

A list of folder names to skip while traversing the tree.

sha

The SHA of the tree to start traversing from (optional).

concurrency

The number of concurrent requests allowed (default is 100).