-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
164 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package fossa | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
const BuildsAPI = "/api/revisions/%s/build" | ||
|
||
// A Build holds the FOSSA API response for the builds API. | ||
type Build struct { | ||
ID int | ||
Error string | ||
Task struct { | ||
Status string | ||
} | ||
} | ||
|
||
// GetBuild loads the build for a project. | ||
func GetBuild(locator Locator) (Build, error) { | ||
var build Build | ||
_, err := GetJSON(fmt.Sprintf(BuildsAPI, url.PathEscape(locator.String())), &build) | ||
if err != nil { | ||
return Build{}, errors.Wrap(err, "could not get Build from API") | ||
} | ||
|
||
return build, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package fossa | ||
|
||
import ( | ||
"fmt" | ||
"net/url" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
const IssuesAPI = "/api/issues/%s" | ||
|
||
// An Issue holds the FOSSA API response for the issue API. | ||
type Issue struct { | ||
PriorityString string | ||
Resolved bool | ||
Revision Revision | ||
Type string | ||
} | ||
|
||
// GetIssues loads the issues for a project. | ||
func GetIssues(locator Locator) ([]Issue, error) { | ||
q := url.Values{} | ||
q.Add("fromRevision", locator.String()) | ||
q.Add("count", "1000") | ||
var issues []Issue | ||
_, err := GetJSON(fmt.Sprintf(IssuesAPI, url.PathEscape(locator.String())+"?"+q.Encode()), &issues) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "could not get Issues from API") | ||
} | ||
|
||
return issues, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.