diff --git a/vendor/github.com/etcinit/gonduit/entities/differential.go b/vendor/github.com/etcinit/gonduit/entities/differential.go index 9d762b9..a383c60 100644 --- a/vendor/github.com/etcinit/gonduit/entities/differential.go +++ b/vendor/github.com/etcinit/gonduit/entities/differential.go @@ -1,6 +1,9 @@ package entities -import "github.com/etcinit/gonduit/util" +import ( + "encoding/json" + "github.com/etcinit/gonduit/util" +) // DifferentialRevision represents a revision in Differential. type DifferentialRevision struct { @@ -26,3 +29,22 @@ type DifferentialRevision struct { Auxiliary map[string][]string `json:"auxiliary"` RepositoryPHID string `json:"repositoryPHID"` } + +func (dr *DifferentialRevision) UnmarshalJSON(data []byte) error { + type Alias DifferentialRevision + temp := &struct { + Reviewers map[string]string `json:"reviewers"` + *Alias + }{ + Alias: (*Alias)(dr), + } + if err := json.Unmarshal(data, &temp); err != nil { + return err + } + + for reviewer := range temp.Reviewers { + dr.Reviewers = append(dr.Reviewers, reviewer) + } + + return nil +} diff --git a/vendor/github.com/etcinit/gonduit/requests/differential_query.go b/vendor/github.com/etcinit/gonduit/requests/differential_query.go index a780194..c383edd 100644 --- a/vendor/github.com/etcinit/gonduit/requests/differential_query.go +++ b/vendor/github.com/etcinit/gonduit/requests/differential_query.go @@ -1,6 +1,9 @@ package requests -import "github.com/etcinit/gonduit/constants" +import ( + "github.com/etcinit/gonduit/constants" + "encoding/json" +) // DifferentialQueryRequest represents a request to the // differential.query call. @@ -21,3 +24,23 @@ type DifferentialQueryRequest struct { Branches []string `json:"branches"` Request } + +func (dqr *DifferentialQueryRequest) UnmarshalJSON(data []byte) error { + type Alias DifferentialQueryRequest + temp := &struct { + Reviewers map[string]string `json:"reviewers"` + *Alias + }{ + Alias: (*Alias)(dqr), + } + if err := json.Unmarshal(data, &temp); err != nil { + return err + } + + dqr.Reviewers = []string{} + for reviewer := range temp.Reviewers { + dqr.Reviewers = append(dqr.Reviewers, reviewer) + } + + return nil +} \ No newline at end of file