@@ -353,3 +353,39 @@ func (p *PullRequestPayload) SetSecret(secret string) {
353353func (p * PullRequestPayload ) JSONPayload () ([]byte , error ) {
354354 return json .MarshalIndent (p , "" , " " )
355355}
356+
357+ //__________ .__ __
358+ //\______ \ ____ ______ ____ _____|__|/ |_ ___________ ___.__.
359+ // | _// __ \\____ \ / _ \/ ___/ \ __\/ _ \_ __ < | |
360+ // | | \ ___/| |_> > <_> )___ \| || | ( <_> ) | \/\___ |
361+ // |____|_ /\___ > __/ \____/____ >__||__| \____/|__| / ____|
362+ // \/ \/|__| \/ \/
363+
364+ // HookRepoAction an action that happens to a repo
365+ type HookRepoAction string
366+
367+ const (
368+ // HookRepoCreated created
369+ HookRepoCreated HookRepoAction = "created"
370+ // HookRepoDeleted deleted
371+ HookRepoDeleted HookRepoAction = "deleted"
372+ )
373+
374+ // RepositoryPayload payload for repository webhooks
375+ type RepositoryPayload struct {
376+ Secret string `json:"secret"`
377+ Action HookRepoAction `json:"action"`
378+ Repository * Repository `json:"repository"`
379+ Organization * User `json:"organization"`
380+ Sender * User `json:"sender"`
381+ }
382+
383+ // SetSecret set the payload's secret
384+ func (p * RepositoryPayload ) SetSecret (secret string ) {
385+ p .Secret = secret
386+ }
387+
388+ // JSONPayload JSON representation of the payload
389+ func (p * RepositoryPayload ) JSONPayload () ([]byte , error ) {
390+ return json .MarshalIndent (p , "" , " " )
391+ }
0 commit comments