SDK reference

Pull requests

Each route's function in the SDK, its call beside the same request in cURL.
orgReposPullsReview

GET/v1/orgs/:orgId/repos/:name/pulls/:number/review

Inline review comments with their file and line, approvals, and how many approvals the pull request still needs.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/review' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgReposPullsReviewComments

POST/v1/orgs/:orgId/repos/:name/pulls/:number/review/comments

Adds a review comment: a new thread on a line of the diff (path, line, side), or a reply (inReplyTo).

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/review/comments' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "body": "example"
  }'
postOrgReposPullsApproval

POST/v1/orgs/:orgId/repos/:name/pulls/:number/approval

Approves the pull request's current revision, or withdraws your approval. Authors can't approve their own.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/approval' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "approve": true
  }'
postOrgReposPullsReopen

POST/v1/orgs/:orgId/repos/:name/pulls/:number/reopen

CodeCommit can't reopen a closed pull request; a new one replaces it under the same number.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/reopen' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgReposPulls

GET/v1/orgs/:orgId/repos/:name/pulls

Lists pull requests in one state, newest first. Listing open pull requests also settles any that were merged or closed outside the portal.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgReposPulls

POST/v1/orgs/:orgId/repos/:name/pulls

Opens a pull request that merges source into target.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "Example",
    "source": "example",
    "target": "example"
  }'
orgReposPullsByNumber

GET/v1/orgs/:orgId/repos/:name/pulls/:number

A pull request with its commit range, the merge strategies available now, its comments, and codeowners: the owners each changed path needs an approval from (null without a CODEOWNERS file).

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
patchOrgReposPullsByNumber

PATCH/v1/orgs/:orgId/repos/:name/pulls/:number

Changes a pull request's title, description, labels or assignees.

Parameters and answers
curl -X PATCH 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "Example",
    "description": "example",
    "labels": [
      "example"
    ]
  }'
orgReposPullsCommits

GET/v1/orgs/:orgId/repos/:name/pulls/:number/commits

Commits the pull request adds to its target.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/commits' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgReposPullsFiles

GET/v1/orgs/:orgId/repos/:name/pulls/:number/files

Changed files with unified diffs.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/files' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgReposPullsMerge

POST/v1/orgs/:orgId/repos/:name/pulls/:number/merge

Merges the pull request. Pass sourceCommitId (the head you reviewed) to fail if the branch has moved since. Into a ruled branch it needs the rule's approvals and code owner reviews (409 otherwise) and a clean secret scan (422); bypass: true merges without the reviews for people on the bypass list, audited.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/merge' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "strategy": "squash"
  }'
postOrgReposPullsClose

POST/v1/orgs/:orgId/repos/:name/pulls/:number/close

Closes the pull request without merging.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/close' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgReposPullsComments

POST/v1/orgs/:orgId/repos/:name/pulls/:number/comments

Adds a comment to a pull request.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/repos/{name}/pulls/{number}/comments' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "body": "example"
  }'