-
Notifications
You must be signed in to change notification settings - Fork 2
add pagination to listBranches and add method listAllBranches #50
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -464,11 +464,13 @@ public function getPullRequestFromBranch(string $owner, string $repositoryName, | |
| * | ||
| * @param string $owner Owner name of the repository | ||
| * @param string $repositoryName Name of the GitHub repository | ||
| * @param int $page Page number for pagination | ||
| * @param int $perPage Number of results per page | ||
| * @return array<string> List of branch names as array | ||
| */ | ||
| public function listBranches(string $owner, string $repositoryName): array | ||
| public function listBranches(string $owner, string $repositoryName, int $page = 1, int $perPage = 30): array | ||
|
Comment on lines
+467
to
+471
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify abstract method signature and find all adapter implementations
echo "=== Checking abstract method definition in Adapter.php ==="
rg -n -A 2 "abstract.*function listBranches" --type=php
echo -e "\n=== Finding all implementations of listBranches ==="
rg -n -B 2 -A 5 "public function listBranches" --type=php
echo -e "\n=== Finding all classes that extend Adapter or Git ==="
rg -n "class.*extends.*(Adapter|Git)" --type=phpRepository: utopia-php/vcs Length of output: 1648 🏁 Script executed: #!/bin/bash
# Check if there are other VCS adapters beyond GitHub
echo "=== Looking for all Adapter subclasses ==="
rg -n "class.*extends.*Adapter|class.*extends.*Git" --type=php
echo -e "\n=== Checking for all branches method calls in tests or elsewhere ==="
rg -n "listBranches" --type=php | head -20Repository: utopia-php/vcs Length of output: 896 Update the abstract method signature to include pagination parameters for consistency. The abstract public function listBranches(string $owner, string $repositoryName): array;While the default values ( 🤖 Prompt for AI Agents
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worried if some other providers would have different ways / not have pagination at all. We can add it in if the next provider has similar behaviours. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @atharvadeosthale That's a very reasonable approach! Waiting to see how pagination works across multiple providers before standardizing the interface is a sound architectural decision. The default parameters you've added ( Your strategy of deferring the abstract method update until there's empirical evidence from a second provider implementation follows good design principles and avoids premature abstraction. This keeps the interface flexible for now while the GitHub implementation validates the pagination pattern.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If there's no pagination on an X provider, we can simply not use the variable. Its best that the base adapter is the source of truth with needed params. cc @atharvadeosthale There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| { | ||
| $url = "/repos/$owner/$repositoryName/branches"; | ||
| $url = "/repos/$owner/$repositoryName/branches?page=$page&per_page=$perPage"; | ||
|
|
||
| $response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"]); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.