-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add endpoint to fetch repo tree #17
Conversation
public function getRepositoryTree(string $owner, string $repositoryName, string $branch, bool $recursive = false): array | ||
{ | ||
// if recursive is true, add optional query param to url | ||
$url = "/repos/$owner/$repositoryName/git/trees/$branch" . ($recursive ? '?recursive=1' : ''); | ||
$response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"]); | ||
|
||
if ($response['headers']['status-code'] == 404) { | ||
return []; | ||
} | ||
|
||
return array_column($response['body']['tree'], 'path'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want a new method? Can we not use the existing listRepositoryContents method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we can add it to the vcs library and may or may not use it in appwrite
public function getRepositoryTree(string $owner, string $repositoryName, string $branch, bool $recursive = false): array | ||
{ | ||
// if recursive is true, add optional query param to url | ||
$url = "/repos/$owner/$repositoryName/git/trees/$branch" . ($recursive ? '?recursive=1' : ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets check if we can specify depth limit
Add endpoint to fetch repo tree to enable UI for root directory selection