github.com/decred/politeia@v1.4.0/politeiawww/legacy/codetracker/codetracker.go (about) 1 // Copyright (c) 2020 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package codetracker 6 7 // CodeTracker interface for getting Code Stats from a git based code tracking 8 // site (Github/Gitlab etc). 9 type CodeTracker interface { 10 // Update updates the code stats for a (organization, repos, start end date) 11 Update(repos []string, start, end int64) 12 13 // UserInfo returns pull request, review and commit information about 14 // a given user over a given start and stop time. 15 UserInfo(username string, start, end int) (*UserInformationResult, error) 16 } 17 18 // UserInformationResult models the data from the userinformation command. 19 type UserInformationResult struct { 20 User string `json:"user"` 21 MergedPRs []PullRequestInformation `json:"mergedprs"` 22 UpdatedPRs []PullRequestInformation `json:"updatedprs"` 23 Commits []CommitInformation `json:"commits"` 24 Reviews []ReviewInformation `json:"reviews"` 25 Year int `json:"year"` 26 Month int `json:"month"` 27 } 28 29 // PullRequestInformation contains all the specific details of pull request. 30 type PullRequestInformation struct { 31 Repository string `json:"repository"` 32 URL string `json:"url"` 33 Number int `json:"number"` 34 Additions int64 `json:"additions"` 35 Deletions int64 `json:"deletions"` 36 Date string `json:"date"` 37 State string `json:"state"` 38 } 39 40 // ReviewInformation contains all the details of a review of a pull request. 41 type ReviewInformation struct { 42 Repository string `json:"repository"` 43 URL string `json:"url"` 44 Number int `json:"number"` 45 Additions int `json:"additions"` 46 Deletions int `json:"deletions"` 47 Date string `json:"date"` 48 State string `json:"state"` 49 } 50 51 // CommitInformation contains all the details of a review of a pull request. 52 type CommitInformation struct { 53 Repository string `json:"repository"` 54 URL string `json:"url"` 55 SHA string `json:"sha"` 56 Additions int `json:"additions"` 57 Deletions int `json:"deletions"` 58 Date int64 `json:"date"` 59 }