Get a pull request's changed files with unified-diff patches
curl --request GET \
--url https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"files": [
{
"additions": 1,
"category": "implementation",
"deletions": 1,
"path": "<string>",
"status": "added",
"patch": "<string>",
"previous_path": "<string>"
}
],
"total_files": 1,
"truncated": true
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Pull Requests
Get a pull request's changed files with unified-diff patches
Reads a pull request’s changed files with their unified-diff patches live from GitHub, pinned to an expected head commit when the caller gives one.
Use this tool when you need to:
- Review what a pull request changes, file by file, with each file’s patch
- Pair patches with file content read at one commit, refusing them if the head moved
Examples:
- GET /pull-requests//github/diff
- GET /pull-requests/6f1c2a9e-3b7d-4c55-9a2e-0d8b1f4e7c21/github/diff?expected_head_sha=9fceb02d0ae598e95dc970b74767f19372d61af8
Hints:
- pullRequestID is the pull request’s uuid; org_id is optional, a uuid naming the owning organization to act in, the org_id getPullRequest answers; expected_head_sha is optional, exactly 40 lowercase hex characters. A value outside those formats is a 422 from the schema.
- Unpinned, the answer is GitHub’s listing at whatever head it holds now. Pinned, GitHub’s head is read before and after the listing and Aether’s mirrored head after it, and any of them other than expected_head_sha is a 409 head_moved rather than another commit’s files.
- files come in GitHub’s listing order, each with path, previous_path for a rename, status (added, removed, modified, renamed, copied, changed or unchanged), category (Aether’s class of the path: implementation, tests, documentation or generated), additions, deletions and patch, absent where GitHub gives none.
- The listing stops at GitHub’s 3000-file cap: truncated is true once files reaches 3000 (exactly 3000 included), and total_files counts the files returned.
- The read goes through Aether’s GitHub App installation, not the caller’s GitHub token; GitHub’s 404 for the pull request is the same 404 as below, and any other GitHub failure a 502.
- Use getPullRequestReviewFile instead for one file’s content at a commit the review read, getPullRequestGithub for the head_sha to pin to, and listPullRequestGithubThreads for the review comments on these files.
- Any member of an owning organization of the pull request (one whose task published or reviewed it, or with a project on its repository) may call it, a viewer included; reading a connected repository is an org right, so no GitHub connection is needed.
- A billing member is refused with 403 org_role_insufficient and a suspended organization with 403 org_suspended, each when no other owning organization admits the caller, and an agent host’s grant with 403 agent_host_route_not_allowed; 503 when the membership check is unavailable.
- A pull request that does not exist, one no organization of the caller owns and an org_id that does not own it answer the same 404; omitting org_id while more than one owning organization admits the caller is a 422 org_id_required.
GET
/
pull-requests
/
{pullRequestID}
/
github
/
diff
Get a pull request's changed files with unified-diff patches
curl --request GET \
--url https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/pull-requests/{pullRequestID}/github/diff")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"files": [
{
"additions": 1,
"category": "implementation",
"deletions": 1,
"path": "<string>",
"status": "added",
"patch": "<string>",
"previous_path": "<string>"
}
],
"total_files": 1,
"truncated": true
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
The pull request's owning organization to act in: the org_id the PullRequest carries. Omitted, getPullRequest and the review page's operations (its review, file, head snapshot and stack) act in the owning organization getPullRequest ranks first, and a console operation refuses with 422 org_id_required when more than one of the caller's organizations owns the pull request.
The head commit the patches must describe; a head that moved past it is a 409.
Pattern:
^[0-9a-f]{40}$