Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #31 from phrase/reopen-jobs
Browse files Browse the repository at this point in the history
Add reopen jobs endpoint
  • Loading branch information
theSoenke authored Aug 10, 2018
2 parents fb976bc + 246b499 commit 20f9056
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions phraseapp/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
)

const (
RevisionDocs = ""
RevisionGenerator = ""
RevisionDocs = "af8c8e121b03fbb27f30326738fd1c3ac086b0a2"
RevisionGenerator = "HEAD/2018-08-10T135953/soenke"
)

type Account struct {
Expand Down Expand Up @@ -2998,6 +2998,31 @@ func (client *Client) JobKeysDelete(project_id, id string, params *JobKeysDelete
return err
}

// Mark a job as uncompleted.
func (client *Client) JobReopen(project_id, id string) (*JobDetails, error) {
retVal := new(JobDetails)
err := func() error {
url := fmt.Sprintf("/v2/projects/%s/jobs/%s/reopen", project_id, id)

rc, err := client.sendRequest("POST", url, "", nil, 200)
if err != nil {
return err
}
defer rc.Close()

var reader io.Reader
if client.debug {
reader = io.TeeReader(rc, os.Stderr)
} else {
reader = rc
}

return json.NewDecoder(reader).Decode(&retVal)

}()
return retVal, err
}

// Get details on a single job for a given project.
func (client *Client) JobShow(project_id, id string) (*JobDetails, error) {
retVal := new(JobDetails)
Expand Down Expand Up @@ -3164,6 +3189,31 @@ func (client *Client) JobLocaleDelete(project_id, job_id, id string) error {
return err
}

// Mark a job locale as uncompleted.
func (client *Client) JobLocaleReopen(project_id, job_id, id string) (*JobLocale, error) {
retVal := new(JobLocale)
err := func() error {
url := fmt.Sprintf("/v2/projects/%s/jobs/%s/locales/%s/reopen", project_id, job_id, id)

rc, err := client.sendRequest("POST", url, "", nil, 200)
if err != nil {
return err
}
defer rc.Close()

var reader io.Reader
if client.debug {
reader = io.TeeReader(rc, os.Stderr)
} else {
reader = rc
}

return json.NewDecoder(reader).Decode(&retVal)

}()
return retVal, err
}

// Get a single job locale for a given job.
func (client *Client) JobLocaleShow(project_id, job_id, id string) (*JobLocale, error) {
retVal := new(JobLocale)
Expand Down

0 comments on commit 20f9056

Please sign in to comment.