2014-07-13 02:01:58 +00:00
|
|
|
package model
|
|
|
|
|
2015-01-14 05:57:02 +00:00
|
|
|
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"`
|
2014-12-30 18:25:14 +00:00
|
|
|
Prior *Commit `json:"prior_commit"`
|
2014-07-13 02:01:58 +00:00
|
|
|
}
|
2015-01-14 05:57:02 +00:00
|
|
|
|
|
|
|
// URL returns the link to the commit in
|
|
|
|
// string format.
|
|
|
|
func (r *Request) URL() string {
|
2015-01-14 07:32:25 +00:00
|
|
|
return fmt.Sprintf("%s/%s/%s/%s/%s/%s",
|
2015-01-14 05:57:02 +00:00
|
|
|
r.Host,
|
|
|
|
r.Repo.Host,
|
|
|
|
r.Repo.Owner,
|
|
|
|
r.Repo.Name,
|
|
|
|
r.Commit.Branch,
|
|
|
|
r.Commit.Sha,
|
|
|
|
)
|
|
|
|
}
|