summaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/code.gitea.io')
-rw-r--r--vendor/code.gitea.io/sdk/gitea/hook.go36
-rw-r--r--vendor/code.gitea.io/sdk/gitea/repo.go8
2 files changed, 44 insertions, 0 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/hook.go b/vendor/code.gitea.io/sdk/gitea/hook.go
index 4b45068127..f93a8ba460 100644
--- a/vendor/code.gitea.io/sdk/gitea/hook.go
+++ b/vendor/code.gitea.io/sdk/gitea/hook.go
@@ -353,3 +353,39 @@ func (p *PullRequestPayload) SetSecret(secret string) {
func (p *PullRequestPayload) JSONPayload() ([]byte, error) {
return json.MarshalIndent(p, "", " ")
}
+
+//__________ .__ __
+//\______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
+// | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
+// | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
+// |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
+// \/ \/|__| \/ \/
+
+// HookRepoAction an action that happens to a repo
+type HookRepoAction string
+
+const (
+ // HookRepoCreated created
+ HookRepoCreated HookRepoAction = "created"
+ // HookRepoDeleted deleted
+ HookRepoDeleted HookRepoAction = "deleted"
+)
+
+// RepositoryPayload payload for repository webhooks
+type RepositoryPayload struct {
+ Secret string `json:"secret"`
+ Action HookRepoAction `json:"action"`
+ Repository *Repository `json:"repository"`
+ Organization *User `json:"organization"`
+ Sender *User `json:"sender"`
+}
+
+// SetSecret set the payload's secret
+func (p *RepositoryPayload) SetSecret(secret string) {
+ p.Secret = secret
+}
+
+// JSONPayload JSON representation of the payload
+func (p *RepositoryPayload) JSONPayload() ([]byte, error) {
+ return json.MarshalIndent(p, "", " ")
+}
diff --git a/vendor/code.gitea.io/sdk/gitea/repo.go b/vendor/code.gitea.io/sdk/gitea/repo.go
index acacb0ec44..b2447618f6 100644
--- a/vendor/code.gitea.io/sdk/gitea/repo.go
+++ b/vendor/code.gitea.io/sdk/gitea/repo.go
@@ -26,9 +26,11 @@ type Repository struct {
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description"`
+ Empty bool `json:"empty"`
Private bool `json:"private"`
Fork bool `json:"fork"`
Mirror bool `json:"mirror"`
+ Size int `json:"size"`
HTMLURL string `json:"html_url"`
SSHURL string `json:"ssh_url"`
CloneURL string `json:"clone_url"`
@@ -156,3 +158,9 @@ func (c *Client) MigrateRepo(opt MigrateRepoOption) (*Repository, error) {
repo := new(Repository)
return repo, c.getParsedResponse("POST", "/repos/migrate", jsonHeader, bytes.NewReader(body), repo)
}
+
+// MirrorSync adds a mirrored repository to the mirror sync queue.
+func (c *Client) MirrorSync(owner, repo string) error {
+ _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/mirror-sync", owner, repo), nil, nil)
+ return err
+}