List Pull Request Files (By ID)
Returns the list of files changed in a pull request with diff patches.
Request
GET
https://api.sourcecraft.tech/pulls/id:{pull_request_id}/files
Path parameters
|
Name |
Description |
|
pull_request_id |
Type: string Example: `` |
Query parameters
|
Name |
Description |
|
page_size |
Type: string<uint64> The maximum number of files to return. The service may return fewer than Example: `` |
|
page_token |
Type: string A page token, received from a previous call. When paginating, all other parameters must match Example: `` |
|
pull_request_slug |
Type: string Example: `` |
Responses
200 OK
A successful response.
Body
application/json
{
"files": [
{
"filename": "example",
"previous_filename": "example",
"status": "added",
"additions": "example",
"deletions": "example",
"changes": "example",
"patch": "example",
"patch_error": "binary"
}
],
"next_page_token": "example"
}
|
Name |
Description |
|
files |
Type: DiffEntry[] List of changed files with diff patches. Example
|
|
next_page_token |
Type: string A token, which can be sent as Example: |
DiffEntry.Status
Type: string
Enum: added, removed, modified, renamed
PatchError
Type: string
Enum: binary, too_large, diff_limit_exceeded, timeout, error
DiffEntry
A single file entry in a pull request diff.
|
Name |
Description |
|
additions |
Type: string<int64> Number of added lines. Example: |
|
changes |
Type: string<int64> Total changed lines (additions + deletions). Example: |
|
deletions |
Type: string<int64> Number of deleted lines. Example: |
|
filename |
Type: string Current file path. Example: |
|
patch |
Type: string Unified diff hunks starting with @@. Empty for binary files. Example: |
|
patch_error |
Type: PatchError Enum: |
|
previous_filename |
Type: string Previous file path (only set for renamed files). Example: |
|
status |
Type: DiffEntry.Status Enum: |
Example
{
"filename": "example",
"previous_filename": "example",
"status": "added",
"additions": "example",
"deletions": "example",
"changes": "example",
"patch": "example",
"patch_error": "binary"
}
default
Both Client Errors (4xx) and Server Errors (5xx) are serialized into this scheme
Body
application/json
{
"error_code": "example",
"message": "example",
"request_id": "example",
"details": {}
}
|
Name |
Description |
||
|
details |
Type: Optional details. Exact structure depends on error_code
Example
|
||
|
error_code |
Type: string Example: |
||
|
message |
Type: string Example: |
||
|
request_id |
Type: string Example: |