Skip to content

Commit

Permalink
add get Jobinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
JojiiOfficial committed Aug 29, 2020
1 parent 323c1e7 commit 953984a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Jobs.go
Expand Up @@ -95,6 +95,25 @@ func (librb LibRB) CancelJob(jobID uint) error {
return nil
}

// JobInfo gets information for a job
func (librb LibRB) JobInfo(jobID uint) (*JobInfo, error) {
var response JobInfo

// Do http request
resp, err := librb.NewRequest(EPJobInfo, JobRequest{
JobID: jobID,
}).WithAuthFromConfig().
WithMethod(GET).
Do(&response)

// Return new error on ... error
if err != nil || resp.Status == ResponseError {
return nil, NewErrorFromResponse(resp, err)
}

return &response, nil
}

// Logs for a job
func (librb LibRB) Logs(jobID uint, since time.Time) (*RestRequestResponse, error) {
// Do http request
Expand Down
1 change: 1 addition & 0 deletions Requests.go
Expand Up @@ -56,6 +56,7 @@ const (
EPJobAdd = EPJob + "/create"
EPJobLogs = EPJob + "/logs"
EPJobCancel = EPJob + "/cancel"
EPJobInfo = EPJob + "/info"
EPJobs = EPJob + "s"

EPJobState = EPJob + "/state"
Expand Down

0 comments on commit 953984a

Please sign in to comment.