From 355093391c4ca080c2c1c05e930ddafd969e4034 Mon Sep 17 00:00:00 2001 From: eyedeekay Date: Sun, 20 Apr 2025 22:23:48 -0400 Subject: [PATCH] add unmigrate command --- .gitignore | 1 + gitea/client.go | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.gitignore b/.gitignore index 6f72f89..a256cc4 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ go.work.sum # env file .env +migrate \ No newline at end of file diff --git a/gitea/client.go b/gitea/client.go index fc96e6d..4cd4118 100644 --- a/gitea/client.go +++ b/gitea/client.go @@ -29,6 +29,23 @@ type VersionResponse struct { Version string `json:"version"` } +// SearchResponse represents the structure of Gitea search responses +type SearchResponse struct { + Data []map[string]interface{} `json:"data"` + OK bool `json:"ok"` + Total int `json:"total_count"` +} + +// SearchRepositories searches for repositories and returns the results +func (c *Client) SearchRepositories() ([]map[string]interface{}, error) { + var response SearchResponse + err := c.Get("/repos/search?limit=1000", &response) + if err != nil { + return nil, err + } + return response.Data, nil +} + // FetchCSRFToken retrieves a CSRF token from Gitea // I don't think it works. func (c *Client) FetchCSRFToken() (string, error) {