Skip to content

Commit

Permalink
Added Pull Requests Statuses (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
craftamap authored Oct 21, 2020
1 parent 34d2968 commit 91a6098
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pullrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,32 @@ func (p *PullRequests) GetComment(po *PullRequestsOptions) (interface{}, error)
return p.c.execute("GET", urlStr, "")
}

func (p *PullRequests) Statuses(po *PullRequestsOptions) (interface{}, error) {
urlStr := p.c.GetApiBaseURL() + "/repositories/" + po.Owner + "/" + po.RepoSlug + "/pullrequests/" + po.ID + "/statuses"
if po.Query != "" {
parsed, err := url.Parse(urlStr)
if err != nil {
return nil, err
}
query := parsed.Query()
query.Set("q", po.Query)
parsed.RawQuery = query.Encode()
urlStr = parsed.String()
}

if po.Sort != "" {
parsed, err := url.Parse(urlStr)
if err != nil {
return nil, err
}
query := parsed.Query()
query.Set("sort", po.Sort)
parsed.RawQuery = query.Encode()
urlStr = parsed.String()
}
return p.c.execute("GET", urlStr, "")
}

func (p *PullRequests) buildPullRequestBody(po *PullRequestsOptions) string {

body := map[string]interface{}{}
Expand Down

0 comments on commit 91a6098

Please sign in to comment.