diff --git a/differential.go b/differential.go index 43db9ac..c6ee924 100644 --- a/differential.go +++ b/differential.go @@ -56,3 +56,13 @@ func (c *Conn) DifferentialRevisionEdit(req requests.EditRequest) (*responses.Ed return &res, nil } + +// DifferentialGetRawDiff performs a call to differential.getrawdiff +func (c *Conn) DifferentialGetRawDiff(req requests.DifferentialGetRawDiffRequest) (*responses.DifferentialGetRawDiffResponse, error) { + var res responses.DifferentialGetRawDiffResponse + if err := c.Call("differential.getrawdiff", &req, &res); err != nil { + return nil, err + } + + return &res, nil +} diff --git a/entities/differential.go b/entities/differential.go index ce44475..a8e8824 100644 --- a/entities/differential.go +++ b/entities/differential.go @@ -69,6 +69,10 @@ type DifferentialHunk struct { Corpus string `json:"corpus"` } +// A DifferentialRawDiff is a raw diff. +type DifferentialRawDiff struct { + Diff string `json:"diff"` +} // DifferentialDiffUpdateTransaction adds a diff (by PHID) to the given revision func DifferentialDiffUpdateTransaction(diff PHID) Transaction { @@ -324,4 +328,4 @@ func DifferentialSetSubscribersTransaction(subscribers []PHID) Transaction { Type: "subscribers.set", Value: subscribers, } -} \ No newline at end of file +} diff --git a/requests/differential_getrawdiff.go b/requests/differential_getrawdiff.go new file mode 100644 index 0000000..45034b1 --- /dev/null +++ b/requests/differential_getrawdiff.go @@ -0,0 +1,7 @@ +package requests + +// DifferentialGetRawDiffRequest represents a request to differential.getrawdiff. +type DifferentialGetRawDiffRequest struct { + DiffID string `json:"diffID"` + Request +} diff --git a/responses/differential_getrawdiff.go b/responses/differential_getrawdiff.go new file mode 100644 index 0000000..1af2223 --- /dev/null +++ b/responses/differential_getrawdiff.go @@ -0,0 +1,6 @@ +package responses + +import "github.com/thought-machine/gonduit/entities" + +// DifferentialGetRawDiffResponse is the response from calling differential.getrawdiff. +type DifferentialGetRawDiffResponse *entities.DifferentialRawDiff diff --git a/test/server/server.go b/test/server/server.go index 18ff3a1..96c3c5f 100644 --- a/test/server/server.go +++ b/test/server/server.go @@ -32,10 +32,10 @@ func New() *Server { func (s *Server) RegisterCapabilities() { s.RegisterMethod("conduit.getcapabilities", 200, gin.H{ "result": map[string][]string{ - "authentication": []string{"token", "session"}, - "signatures": []string{"consign"}, - "input": []string{"json", "urlencoded"}, - "output": []string{"json"}, + "authentication": {"token", "session"}, + "signatures": {"consign"}, + "input": {"json", "urlencoded"}, + "output": {"json"}, }, }) }