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
this value.

Example: ``

page_token

Type: string

A page token, received from a previous call.
Provide this to retrieve the subsequent page.

When paginating, all other parameters must match
the call that provided the page token.

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
[
  {
    "filename": "example",
    "previous_filename": "example",
    "status": "added",
    "additions": "example",
    "deletions": "example",
    "changes": "example",
    "patch": "example",
    "patch_error": "binary"
  }
]

next_page_token

Type: string

A token, which can be sent as page_token to retrieve the next page.
If this field is empty, there are no subsequent pages.

Example: 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: example

changes

Type: string<int64>

Total changed lines (additions + deletions).

Example: example

deletions

Type: string<int64>

Number of deleted lines.

Example: example

filename

Type: string

Current file path.

Example: example

patch

Type: string

Unified diff hunks starting with @@. Empty for binary files.

Example: example

patch_error

Type: PatchError

Enum: binary, too_large, diff_limit_exceeded, timeout, error

previous_filename

Type: string

Previous file path (only set for renamed files).

Example: example

status

Type: DiffEntry.Status

Enum: added, removed, modified, renamed

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

[additional]

Type: string

Example: example

Example
{}

error_code

Type: string

Example: example

message

Type: string

Example: example

request_id

Type: string

Example: example

Предыдущая
Следующая