From d5e174e5b561d52f36cd4822f21229a2f4ef7915 Mon Sep 17 00:00:00 2001 From: venc0r Date: Tue, 26 Sep 2023 00:01:48 +0000 Subject: [PATCH] feat(hook): add support for authorization_header in webhooks (#633) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #632 Co-authored-by: Jörg Markert Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/633 Reviewed-by: John Olheiser Co-authored-by: venc0r Co-committed-by: venc0r --- gitea/hook.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gitea/hook.go b/gitea/hook.go index 67a7518..bdc80a1 100644 --- a/gitea/hook.go +++ b/gitea/hook.go @@ -95,11 +95,12 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, *Response, err // CreateHookOption options when create a hook type CreateHookOption struct { - Type HookType `json:"type"` - Config map[string]string `json:"config"` - Events []string `json:"events"` - BranchFilter string `json:"branch_filter"` - Active bool `json:"active"` + Type HookType `json:"type"` + Config map[string]string `json:"config"` + Events []string `json:"events"` + BranchFilter string `json:"branch_filter"` + Active bool `json:"active"` + AuthorizationHeader string `json:"authorization_header"` } // Validate the CreateHookOption struct @@ -143,10 +144,11 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook, // EditHookOption options when modify one hook type EditHookOption struct { - Config map[string]string `json:"config"` - Events []string `json:"events"` - BranchFilter string `json:"branch_filter"` - Active *bool `json:"active"` + Config map[string]string `json:"config"` + Events []string `json:"events"` + BranchFilter string `json:"branch_filter"` + Active *bool `json:"active"` + AuthorizationHeader string `json:"authorization_header"` } // EditOrgHook modify one hook of an organization, with hook id and options