summaryrefslogtreecommitdiff
path: root/internal/codeberg/codeberg.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/codeberg/codeberg.go')
-rw-r--r--internal/codeberg/codeberg.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/codeberg/codeberg.go b/internal/codeberg/codeberg.go
index 0d587de..f881be9 100644
--- a/internal/codeberg/codeberg.go
+++ b/internal/codeberg/codeberg.go
@@ -8,6 +8,7 @@ import (
"net/http"
"os"
"path/filepath"
+ "strings"
"time"
"codeberg.org/snonux/gitsyncer/internal/forge"
@@ -39,6 +40,7 @@ type Client struct {
}
var _ forge.RepoClient = (*Client)(nil)
+var _ forge.RepoDescriptionClient = (*Client)(nil)
// NewClient creates a new Codeberg API client
func NewClient(token, org string) *Client {
@@ -111,6 +113,15 @@ func (c *Client) GetRepo(repoName string) (Repository, bool, error) {
return repo, true, nil
}
+// GetRepoDescription fetches a repository description.
+func (c *Client) GetRepoDescription(repoName string) (string, bool, error) {
+ repo, exists, err := c.GetRepo(repoName)
+ if err != nil || !exists {
+ return "", exists, err
+ }
+ return strings.TrimSpace(repo.Description), true, nil
+}
+
// UpdateRepoDescription updates a repository description on Codeberg
func (c *Client) UpdateRepoDescription(repoName, description string) error {
if !c.HasToken() {