Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: go/rietveld/rietveld.go

Issue 1409103004: Extend Trybot list view (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | golden/go/db/db.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/rietveld/rietveld.go
diff --git a/go/rietveld/rietveld.go b/go/rietveld/rietveld.go
index 8571378eb9f195f2ce0b0555155b36e289f63f6a..3c09108d3b00cccf27e86c3214512e7fb50851a6 100644
--- a/go/rietveld/rietveld.go
+++ b/go/rietveld/rietveld.go
@@ -83,6 +83,19 @@ func (r *Rietveld) Url() string {
return r.url
}
+// Patchset contains the information about one patchset.
+// Currently we ommit fields that we don't need.
+type Patchset struct {
+ Patchset int64 `json:"patchset"`
+ Issue int64 `json:"issue"`
+ Owner string `json:"owner"`
+ OwnerEmail string `json:"owner_email"`
+ Created time.Time
+ CreatedStr string `json:"created"`
+ Modified time.Time
+ ModifiedStr string `json:"modified"`
+}
+
func parseTime(t string) time.Time {
parsed, _ := time.Parse("2006-01-02 15:04:05.999999", t)
return parsed
@@ -271,3 +284,15 @@ func (r *Rietveld) Search(limit int, terms ...*SearchTerm) ([]*Issue, error) {
sort.Sort(issues)
return issues, nil
}
+
+func (r Rietveld) GetPatchset(issueID int64, patchsetID int64) (*Patchset, error) {
+ url := fmt.Sprintf("/api/%d/%d", issueID, patchsetID)
+ patchset := &Patchset{}
+ if err := r.get(url, patchset); err != nil {
+ return nil, err
+ }
+
+ patchset.Created = parseTime(patchset.CreatedStr)
+ patchset.Modified = parseTime(patchset.ModifiedStr)
+ return patchset, nil
+}
« no previous file with comments | « no previous file | golden/go/db/db.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698