woodpecker/shared/model/request.go

27 lines
436 B
Go
Raw Normal View History

2014-07-13 02:01:58 +00:00
package model
import (
"fmt"
)
2014-07-13 02:01:58 +00:00
type Request struct {
Host string `json:"-"`
User *User `json:"-"`
Repo *Repo `json:"repo"`
Commit *Commit `json:"commit"`
Prior *Commit `json:"prior_commit"`
2014-07-13 02:01:58 +00:00
}
// URL returns the link to the commit in
// string format.
func (r *Request) URL() string {
return fmt.Sprintf("%s/%s/%s/%s",
r.Host,
r.Repo.Host,
r.Repo.Owner,
r.Repo.Name,
r.Commit.Branch,
r.Commit.Sha,
)
}