List Comments

Request

GET

https://api.sourcecraft.tech/repos/{org_slug}/{repo_slug}/pulls/{pull_request_slug}/comments

Path parameters

Name

Description

org_slug

Type: string

Example: ``

pull_request_slug

Type: string

Example: ``

repo_slug

Type: string

Example: ``

Query parameters

Name

Description

iteration

Type: string

Example: ``

only_drafts

Type: boolean

Only drafts (unpublished) comments

page_size

Type: string<uint64>

The maximum number of comments 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_id

Type: string

Example: ``

sort_by

Type: string

Ordering options: comma separated list of fields. For example: "name, created_at"
Default sorting order is ascending. To specify descending order for a field,
append a "-" prefix; for example: "name, -created_at"
Redundant space characters in the syntax are insignificant. "foo, -bar", " foo , -bar", and "foo,bar"
are all equivalent.
Available fields: iteration, author_id, parent_id

Example: ``

Responses

200 OK

A successful response.

Body

application/json
{
  "pull_request_comments": [
    {
      "id": "example",
      "body": "example",
      "parent_id": "example",
      "author": {
        "id": "example",
        "slug": "example"
      },
      "updated_by": null,
      "created_at": "2025-01-01T00:00:00Z",
      "updated_at": "2025-01-01T00:00:00Z",
      "is_deleted": true,
      "reactions": {},
      "anchor": {
        "path": "example",
        "position": {
          "from": 0,
          "to": 0,
          "side": "target",
          "outdated": true
        },
        "hunk": {
          "from_start": 0,
          "from_count": 0,
          "to_start": 0,
          "to_count": 0,
          "patch": "example"
        }
      },
      "need_resolution": true,
      "is_resolved": true,
      "is_published": true,
      "is_outdated": true,
      "type": "default",
      "iteration": "example",
      "resolution_state": "no_resolution_needed"
    }
  ],
  "next_page_token": "example"
}

Name

Description

next_page_token

Type: string

Example: example

pull_request_comments

Type: PullRequestComment[]

Example
[
  {
    "id": "example",
    "body": "example",
    "parent_id": "example",
    "author": {
      "id": "example",
      "slug": "example"
    },
    "updated_by": null,
    "created_at": "2025-01-01T00:00:00Z",
    "updated_at": "2025-01-01T00:00:00Z",
    "is_deleted": true,
    "reactions": {},
    "anchor": {
      "path": "example",
      "position": {
        "from": 0,
        "to": 0,
        "side": "target",
        "outdated": true
      },
      "hunk": {
        "from_start": 0,
        "from_count": 0,
        "to_start": 0,
        "to_count": 0,
        "patch": "example"
      }
    },
    "need_resolution": true,
    "is_resolved": true,
    "is_published": true,
    "is_outdated": true,
    "type": "default",
    "iteration": "example",
    "resolution_state": "no_resolution_needed"
  }
]

UserEmbedded

Name

Description

id

Type: string

Example: example

slug

Type: string

Example: example

Example
{
  "id": "example",
  "slug": "example"
}

ReactionCount

Name

Description

count

Type: integer

self_react

Type: boolean

Example
{
  "count": 0,
  "self_react": true
}

Side

Type: string

Enum: target, source

DiffPos

Name

Description

from

Type: integer

Start of commented region, line number (1-based).

outdated

Type: boolean

Indicates whether commented region has changed after initial comment publishing.

side

Type: Side

Enum: target, source

to

Type: integer

End of commented region, line number (1-based).

Example
{
  "from": 0,
  "to": 0,
  "side": "target",
  "outdated": true
}

Hunk

Name

Description

from_count

Type: integer

from_start

Type: integer

patch

Type: string

Example: example

to_count

Type: integer

to_start

Type: integer

Example
{
  "from_start": 0,
  "from_count": 0,
  "to_start": 0,
  "to_count": 0,
  "patch": "example"
}

Anchor

Name

Description

hunk

Type: Hunk

Example
{
  "from_start": 0,
  "from_count": 0,
  "to_start": 0,
  "to_count": 0,
  "patch": "example"
}

path

Type: string

Example: example

position

Type: DiffPos

Example
{
  "from": 0,
  "to": 0,
  "side": "target",
  "outdated": true
}
Example
{
  "path": "example",
  "position": {
    "from": 0,
    "to": 0,
    "side": "target",
    "outdated": true
  },
  "hunk": {
    "from_start": 0,
    "from_count": 0,
    "to_start": 0,
    "to_count": 0,
    "patch": "example"
  }
}

PullRequestComment.Type

Type: string

Enum: default, appsec

ResolutionState

Resolution state for pull request comments.
Transition from no_resolution_needed directly to resolved is not allowed:
set to awaiting_resolution first, then resolve.

Type: string

Enum: no_resolution_needed, awaiting_resolution, resolved

PullRequestComment

Name

Description

anchor

Type: Anchor

Example
{
  "path": "example",
  "position": {
    "from": 0,
    "to": 0,
    "side": "target",
    "outdated": true
  },
  "hunk": {
    "from_start": 0,
    "from_count": 0,
    "to_start": 0,
    "to_count": 0,
    "patch": "example"
  }
}

author

Type: UserEmbedded

Example
{
  "id": "example",
  "slug": "example"
}

body

Type: string

Example: example

created_at

Type: string<date-time>

Example: 2025-01-01T00:00:00Z

id

Type: string

Example: example

is_deleted

Type: boolean

is_outdated

Type: boolean

is_published

Type: boolean

is_resolved

Type: boolean

Deprecated: use resolution_state instead.

iteration

Type: string<uint64>

Example: example

need_resolution

Type: boolean

Deprecated: use resolution_state instead.

parent_id

Type: string

Example: example

reactions

Type: object

[additional]

Type: ReactionCount

Example
{
  "count": 0,
  "self_react": true
}
Example
{}

resolution_state

Type: ResolutionState

Resolution state for pull request comments.
Transition from no_resolution_needed directly to resolved is not allowed:
set to awaiting_resolution first, then resolve.

Enum: no_resolution_needed, awaiting_resolution, resolved

type

Type: PullRequestComment.Type

Enum: default, appsec

updated_at

Type: string<date-time>

Example: 2025-01-01T00:00:00Z

updated_by

Type: UserEmbedded

Example
{
  "id": "example",
  "slug": "example"
}
Example
{
  "id": "example",
  "body": "example",
  "parent_id": "example",
  "author": {
    "id": "example",
    "slug": "example"
  },
  "updated_by": null,
  "created_at": "2025-01-01T00:00:00Z",
  "updated_at": "2025-01-01T00:00:00Z",
  "is_deleted": true,
  "reactions": {},
  "anchor": {
    "path": "example",
    "position": {
      "from": 0,
      "to": 0,
      "side": "target",
      "outdated": true
    },
    "hunk": {
      "from_start": 0,
      "from_count": 0,
      "to_start": 0,
      "to_count": 0,
      "patch": "example"
    }
  },
  "need_resolution": true,
  "is_resolved": true,
  "is_published": true,
  "is_outdated": true,
  "type": "default",
  "iteration": "example",
  "resolution_state": "no_resolution_needed"
}

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

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