github.com/billybanfield/evergreen@v0.0.0-20170525200750-eeee692790f7/thirdparty/github_models.go (about) 1 package thirdparty 2 3 import ( 4 "time" 5 ) 6 7 // Github API response structs 8 type PatchSummary struct { 9 Name string 10 Additions int 11 Deletions int 12 } 13 14 type CommitEvent struct { 15 URL string 16 SHA string 17 Commit CommitDetails 18 Author AuthorDetails 19 Committer AuthorDetails 20 Parents []Tree 21 Stats Stats 22 Files []File 23 } 24 25 type BranchEvent struct { 26 Name string 27 Commit GithubCommit 28 Author CommitAuthor 29 Parents []Parent 30 URL string 31 Commiter AuthorDetails 32 Links Link 33 } 34 35 type GithubCommit struct { 36 Url string 37 SHA string 38 Commit CommitDetails 39 Author CommitAuthor 40 Committer CommitAuthor 41 Parents []Parent 42 } 43 44 type GithubFile struct { 45 Name string 46 Path string 47 SHA string 48 Size int 49 URL string 50 HtmlURL string 51 GitURL string 52 Type string 53 Content string 54 Encoding string 55 Links Link 56 } 57 58 type Link struct { 59 Self string 60 Git string 61 Html string 62 } 63 64 type Parent struct { 65 Url string 66 Sha string 67 } 68 69 type CommitDetails struct { 70 URL string 71 Author CommitAuthor 72 Committer CommitAuthor 73 Message string 74 Tree Tree 75 } 76 77 type CommitAuthor struct { 78 Name string 79 Email string 80 Date time.Time 81 } 82 83 type AuthorDetails struct { 84 Login string 85 Id int 86 AvatarURL string 87 GravatarId string 88 URL string 89 } 90 91 type Tree struct { 92 URL string 93 SHA string 94 } 95 96 type Stats struct { 97 Additions int 98 Deletions int 99 Total int 100 } 101 102 type File struct { 103 FileName string 104 Additions int 105 Deletions int 106 Changes int 107 Status string 108 RawURL string 109 BlobURL string 110 ContentsURL string 111 Patch string 112 } 113 114 type GithubLoginUser struct { 115 Login string 116 Id int 117 Company string 118 EmailAddress string `json:"email"` 119 Name string 120 OrganizationsURL string 121 } 122 123 func (u *GithubLoginUser) DisplayName() string { 124 return u.Name 125 } 126 127 func (u *GithubLoginUser) Email() string { 128 return u.EmailAddress 129 } 130 131 func (u *GithubLoginUser) Username() string { 132 return u.Login 133 } 134 135 type GithubAuthParameters struct { 136 ClientId string `json:"client_id"` 137 ClientSecret string `json:"client_secret"` 138 Code string `json:"code"` 139 RedirectUri string `json:"redirect_uri"` 140 State string `json:"state"` 141 } 142 143 type GithubOrganization struct { 144 Login string `json:"login"` 145 Url string `json:"url"` 146 } 147 148 type GithubAuthResponse struct { 149 AccessToken string `json:"access_token"` 150 Scope string `json:"scope"` 151 TokenType string `json:"token_type"` 152 } 153 154 type GitHubCompareResponse struct { 155 Url string `json:"url"` 156 HtmlUrl string `json:"html_url"` 157 PermalinkUrl string `json:"permalink_url"` 158 DiffUrl string `json:"diff_url"` 159 PatchUrl string `json:"patch_url"` 160 BaseCommit CommitEvent `json:"base_commit"` 161 Author AuthorDetails `json:"author"` 162 Committer AuthorDetails `json:"committer"` 163 Parents []Parent `json:"parents"` 164 MergeBaseCommit CommitEvent `json:"merge_base_commit"` 165 Files File `json:"file"` 166 Commits []CommitDetails `json:"commits"` 167 TotalCommits int `json:"total_commits"` 168 BehindBy int `json:"behind_by"` 169 AheadBy int `json:"ahead_by"` 170 Status string `json:"status"` 171 }