Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package core
import (
"crypto/tls"
"net/http"
"time"
)

// ClientOptions are options that can be set on the HTTP client.
Expand All @@ -14,11 +15,13 @@ type ClientOptions struct {
SessionKey string

InsecureSkipVerify bool
Timeout time.Duration
}

// makeHttpClient creates a new HTTP client for making API requests.
func makeHTTPClient(options *ClientOptions) *http.Client {
return &http.Client{
Timeout: options.Timeout,
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: options.InsecureSkipVerify,
Expand Down
13 changes: 13 additions & 0 deletions differential.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@ func (c *Conn) DifferentialQuery(

return &res, nil
}

// DifferentialQuery performs a call to differential.querydiffs.
func (c *Conn) DifferentialQueryDiffs(
req requests.DifferentialQueryDiffsRequest,
) (*responses.DifferentialQueryDiffsResponse, error) {
var res responses.DifferentialQueryDiffsResponse

if err := c.Call("differential.querydiffs", &req, &res); err != nil {
return nil, err
}

return &res, nil
}
31 changes: 31 additions & 0 deletions entities/differential.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,34 @@ type DifferentialRevision struct {
Auxiliary map[string][]string `json:"auxiliary"`
RepositoryPHID string `json:"repositoryPHID"`
}

// DifferentialDiff represents a specific diff within a Differential revision.
// A new diff is created every time you update a differential revision (that's
// what arc diff does duh).
//
// NOTE: Two fields are missing from this struct:
//
// - Changes (changes) is a list of a fairly complex data-structure with all
// hunks contained in this diff along with some dynamically typed metadata;
// - Properties (properties) is another dynamically typed field which will be
// an empty list on a closed diff (as far as I can tell) or a fairly complex
// data-structure containing more metadata about the diff (info about the
// local commits and about arc's interaction with the staging area if you
// repository has one set up).
type DifferentialDiff struct {
ID string `json:"id"`
RevisionID string `json:"revisionID"`
DateCreated util.UnixTimestamp `json:"dateCreated"`
DateModified util.UnixTimestamp `json:"dateModified"`
SourceControlBaseRevision string `json:"sourceControlBaseRevision"`
SourceControlPath string `json:"sourceControlPath"`
SourceControlSystem string `json:"sourceControlSystem"`
Branch string `json:"branch"`
Bookmark string `json:"bookmark"`
CreationMethod string `json:"creationMethod"`
Description string `json:"description"`
UnitStatus string `json:"unitStatus"`
LintStatus string `json:"lintStatus"`
AuthorName string `json:"authorName"`
AuthorEmail string `json:"authorEmail"`
}
9 changes: 9 additions & 0 deletions requests/differential_querydiffs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package requests

// DifferentialQueryRequest represents a request
// to the differential.querydiffs call.
type DifferentialQueryDiffsRequest struct {
IDs []uint64 `json:"ids"`
RevisionIDs []uint64 `json:"revisionIDs"`
Request
}
6 changes: 6 additions & 0 deletions responses/differential_querydiffs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package responses

import "github.com/etcinit/gonduit/entities"

// DifferentialQueryDiffsResponse is the response of calling differential.querydiffs.
type DifferentialQueryDiffsResponse []*entities.DifferentialDiff