consistent use of the _url in REST API

This commit is contained in:
Brad Rydzewski 2015-09-03 17:21:08 -07:00
parent bdd99041f4
commit dbf0fa6ee0
11 changed files with 23 additions and 19 deletions

View file

@ -3,7 +3,7 @@
<ul ng-if="user">
<li>
<img ng-src="{{ user.avatar }}" />
<img ng-src="{{ user.avatar_url }}" />
</li>
<li ng-init="show=false">
<a href="#" ng-click="show=true">

View file

@ -26,7 +26,7 @@
<ul class="list cozy" ng-show="!waiting && !error">
<a class="row row-repo" ng-repeat="repo in repos | orderBy:'full_name' | filter: search_text" ng-href="/{{ repo.full_name }}">
<div class="column-avatar">
<img ng-src="{{ repo.avatar }}" />
<img ng-src="{{ repo.avatar_url }}" />
</div>
<div class="column-fill">
<h2>{{ repo.name }}</h2>

View file

@ -28,7 +28,7 @@
<ul class="list cozy user-list">
<li class="row row-user" ng-repeat="user in users | orderBy:'login' | filter: search_text">
<div class="column-avatar">
<img ng-src="{{ user.avatar || 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y' }}" />
<img ng-src="{{ user.avatar_url || 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y' }}" />
</div>
<div class="column-fill">
<h2>{{ user.login }} <small ng-if="user.admin" class="label label-success">Admin</small></h2>

View file

@ -812,7 +812,7 @@ definitions:
{
"login": "Octocat",
"email": "octocat@github.com",
"avatar": "7194e8d48fa1d2b689f99443b767316c",
"avatar_url": "http://www.gravatar.com/avatar/7194e8d48fa1d2b689f99443b767316c",
"admin": false,
"active": true
}
@ -821,7 +821,7 @@ definitions:
type: string
email:
type: string
avatar:
avatar_url:
type: string
admin:
type: boolean
@ -929,6 +929,7 @@ definitions:
"head_commit": {
"sha": "d101ef3ed6e973b039c3fd5ccdec378b0fa8684c",
"ref": "refs\/heads\/master",
"link_url": "https:\/\/github.com\/drone\/drone\/commit\/d101ef3ed6",
"branch": "master",
"message": "updated the README.md file",
"timestamp": "",

View file

@ -302,7 +302,7 @@ func (g *GitHub) push(r *http.Request) (*common.Hook, error) {
return nil, nil
}
return &common.Hook{Repo: repo, Commit: commit}, nil
return &common.Hook{Event: "push", Repo: repo, Commit: commit}, nil
}
// ¯\_(ツ)_/¯
@ -385,7 +385,7 @@ func (g *GitHub) pullRequest(r *http.Request) (*common.Hook, error) {
// Author.Login
// Author.Email
return &common.Hook{Repo: repo, Commit: c, PullRequest: pr}, nil
return &common.Hook{Event: "pull_request", Repo: repo, Commit: c, PullRequest: pr}, nil
}
type pushHook struct {

View file

@ -256,7 +256,7 @@ func (g *Gitlab) Hook(req *http.Request) (*common.Hook, error) {
func mergeRequest(parsed *gogitlab.HookPayload, req *http.Request) (*common.Hook, error) {
var hook = new(common.Hook)
hook.Event = "pull_request"
hook.Repo = &common.Repo{}
hook.Repo.Owner = req.FormValue("owner")
hook.Repo.Name = req.FormValue("name")
@ -295,6 +295,7 @@ func push(parsed *gogitlab.HookPayload, req *http.Request) (*common.Hook, error)
var cloneUrl = parsed.Repository.GitHttpUrl
var hook = new(common.Hook)
hook.Event = "push"
hook.Repo = &common.Repo{}
hook.Repo.Owner = req.FormValue("owner")
hook.Repo.Name = req.FormValue("name")

View file

@ -11,8 +11,9 @@ const (
type Build struct {
ID int64
RepoID int64 `json:"-" sql:"unique:ux_build_number,index:ix_build_repo_id"`
RepoID int64 `json:"id" sql:"unique:ux_build_number,index:ix_build_repo_id"`
Number int `json:"number" sql:"unique:ux_build_number"`
Event string `json:"event"`
Status string `json:"status"`
Started int64 `json:"started_at"`
Finished int64 `json:"finished_at"`
@ -26,14 +27,14 @@ type Build struct {
type PullRequest struct {
Number int `json:"number,omitempty"`
Title string `json:"title,omitempty"`
Link string `json:"link,omitempty"`
Link string `json:"link_url,omitempty"`
Base *Commit `json:"base_commit,omitempty"`
}
type Commit struct {
Sha string `json:"sha"`
Ref string `json:"ref"`
Link string `json:"link,omitempty"`
Link string `json:"link_url,omitempty"`
Branch string `json:"branch" sql:"index:ix_commit_branch"`
Message string `json:"message"`
Timestamp string `json:"timestamp,omitempty"`

View file

@ -1,6 +1,7 @@
package types
type Hook struct {
Event string
Repo *Repo
Commit *Commit
PullRequest *PullRequest

View file

@ -6,7 +6,7 @@ type Repo struct {
Owner string `json:"owner" sql:"unique:ux_repo_owner_name"`
Name string `json:"name" sql:"unique:ux_repo_owner_name"`
FullName string `json:"full_name" sql:"unique:ux_repo_full_name"`
Avatar string `json:"avatar"`
Avatar string `json:"avatar_url"`
Self string `json:"self_url"`
Link string `json:"link_url"`
Clone string `json:"clone_url"`

View file

@ -1,10 +1,10 @@
package types
type Status struct {
ID int64 `meddler:"status_id,pk" json:"-"`
CommitID int64 `meddler:"commit_id" json:"-"`
State string `meddler:"status_state" json:"state"`
Link string `meddler:"status_link" json:"target_url"`
Desc string `meddler:"status_desc" json:"description"`
Context string `meddler:"status_context" json:"context"`
ID int64 `json:"-"`
CommitID int64 `json:"-"`
State string `json:"status"`
Link string `json:"target_url"`
Desc string `json:"description"`
Context string `json:"context"`
}

View file

@ -6,7 +6,7 @@ type User struct {
Token string `json:"-"`
Secret string `json:"-"`
Email string `json:"email,omitempty"`
Avatar string `json:"avatar,omitempty"`
Avatar string `json:"avatar_url,omitempty"`
Active bool `json:"active,omitempty"`
Admin bool `json:"admin,omitempty"`