InfoGrab Docs

변경 사항 제안 API

요약

이 API를 사용하여 코드 제안을 관리합니다. 제안은 코드에 직접 적용할 수 있는 특정 변경 사항을 제안하는 방법을 제공합니다. API를 통해 제안을 생성하려면 Discussions API를 사용하여 머지 리퀘스트 diff에 새 스레드를 생성합니다.

이 API를 사용하여 코드 제안을 관리합니다.

제안은 코드에 직접 적용할 수 있는 특정 변경 사항을 제안하는 방법을 제공합니다. 이 API를 사용하여 머지 리퀘스트 토론에서 코드 제안을 프로그래밍 방식으로 생성하고 적용할 수 있습니다. 제안에 대한 모든 API 호출은 인증이 필요합니다.

제안 생성#

API를 통해 제안을 생성하려면 Discussions API를 사용하여 머지 리퀘스트 diff에 새 스레드를 생성합니다. 제안의 형식은 다음과 같습니다:

```suggestion:-3+0
example text
```

제안 적용#

머지 리퀘스트에서 제안된 패치를 적용합니다.

사전 요구 사항:

  • Developer, Maintainer 또는 Owner 권한이 있어야 합니다.
PUT /suggestions/:id/apply

지원되는 속성:

속성 유형 필수 설명
id integer 제안의 ID.
commit_message string 아니요 기본 생성된 메시지 또는 프로젝트의 기본 메시지 대신 사용할 커스텀 커밋 메시지.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
applicable boolean true이면 제안을 적용할 수 있습니다.
applied boolean true이면 제안이 적용되었습니다.
from_content string 제안 이전의 원본 콘텐츠.
from_line integer 제안의 시작 줄 번호.
id integer 제안의 ID.
to_content string 원본을 대체할 제안된 콘텐츠.
to_line integer 제안의 끝 줄 번호.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/suggestions/5/apply"

응답 예시:

{
  "id": 5,
  "from_line": 10,
  "to_line": 10,
  "applicable": true,
  "applied": false,
  "from_content": "This is an example\n",
  "to_content": "This is an example\n"
}

여러 제안 적용#

머지 리퀘스트에서 여러 제안된 패치를 적용합니다.

사전 요구 사항:

  • Developer, Maintainer 또는 Owner 권한이 있어야 합니다.
PUT /suggestions/batch_apply

지원되는 속성:

속성 유형 필수 설명
ids integer array 적용할 제안의 ID.
commit_message string 아니요 기본 생성된 메시지 또는 프로젝트의 기본 메시지 대신 사용할 커스텀 커밋 메시지.

성공하면 200 OK와 다음 응답 속성을 포함하는 제안 오브젝트 배열을 반환합니다:

속성 유형 설명
applicable boolean true이면 제안을 적용할 수 있습니다.
applied boolean true이면 제안이 적용되었습니다.
from_content string 제안 이전의 원본 콘텐츠.
from_line integer 제안의 시작 줄 번호.
id integer 제안의 ID.
to_content string 원본을 대체할 제안된 콘텐츠.
to_line integer 제안의 끝 줄 번호.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{"ids": [5, 6]}' \
  --url "https://gitlab.example.com/api/v4/suggestions/batch_apply"

응답 예시:

[
  {
    "id": 5,
    "from_line": 10,
    "to_line": 10,
    "applicable": true,
    "applied": false,
    "from_content": "This is an example\n",
    "to_content": "This is an example\n"
  },
  {
    "id": 6,
    "from_line": 19,
    "to_line": 19,
    "applicable": true,
    "applied": false,
    "from_content": "This is another example\n",
    "to_content": "This is another example\n"
  }
]

변경 사항 제안 API

Tier: Free, Premium, Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

이 API를 사용하여 코드 제안을 관리합니다. 제안은 코드에 직접 적용할 수 있는 특정 변경 사항을 제안하는 방법을 제공합니다. API를 통해 제안을 생성하려면 Discussions API를 사용하여 머지 리퀘스트 diff에 새 스레드를 생성합니다.

이 API를 사용하여 코드 제안을 관리합니다.

제안은 코드에 직접 적용할 수 있는 특정 변경 사항을 제안하는 방법을 제공합니다. 이 API를 사용하여 머지 리퀘스트 토론에서 코드 제안을 프로그래밍 방식으로 생성하고 적용할 수 있습니다. 제안에 대한 모든 API 호출은 인증이 필요합니다.

제안 생성#

API를 통해 제안을 생성하려면 Discussions API를 사용하여 머지 리퀘스트 diff에 새 스레드를 생성합니다. 제안의 형식은 다음과 같습니다:

```suggestion:-3+0
example text
```

제안 적용#

머지 리퀘스트에서 제안된 패치를 적용합니다.

사전 요구 사항:

  • Developer, Maintainer 또는 Owner 권한이 있어야 합니다.
PUT /suggestions/:id/apply

지원되는 속성:

속성 유형 필수 설명
id integer 제안의 ID.
commit_message string 아니요 기본 생성된 메시지 또는 프로젝트의 기본 메시지 대신 사용할 커스텀 커밋 메시지.

성공하면 200 OK와 다음 응답 속성을 반환합니다:

속성 유형 설명
applicable boolean true이면 제안을 적용할 수 있습니다.
applied boolean true이면 제안이 적용되었습니다.
from_content string 제안 이전의 원본 콘텐츠.
from_line integer 제안의 시작 줄 번호.
id integer 제안의 ID.
to_content string 원본을 대체할 제안된 콘텐츠.
to_line integer 제안의 끝 줄 번호.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/suggestions/5/apply"

응답 예시:

{
  "id": 5,
  "from_line": 10,
  "to_line": 10,
  "applicable": true,
  "applied": false,
  "from_content": "This is an example\n",
  "to_content": "This is an example\n"
}

여러 제안 적용#

머지 리퀘스트에서 여러 제안된 패치를 적용합니다.

사전 요구 사항:

  • Developer, Maintainer 또는 Owner 권한이 있어야 합니다.
PUT /suggestions/batch_apply

지원되는 속성:

속성 유형 필수 설명
ids integer array 적용할 제안의 ID.
commit_message string 아니요 기본 생성된 메시지 또는 프로젝트의 기본 메시지 대신 사용할 커스텀 커밋 메시지.

성공하면 200 OK와 다음 응답 속성을 포함하는 제안 오브젝트 배열을 반환합니다:

속성 유형 설명
applicable boolean true이면 제안을 적용할 수 있습니다.
applied boolean true이면 제안이 적용되었습니다.
from_content string 제안 이전의 원본 콘텐츠.
from_line integer 제안의 시작 줄 번호.
id integer 제안의 ID.
to_content string 원본을 대체할 제안된 콘텐츠.
to_line integer 제안의 끝 줄 번호.

요청 예시:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --header "Content-Type: application/json" \
  --data '{"ids": [5, 6]}' \
  --url "https://gitlab.example.com/api/v4/suggestions/batch_apply"

응답 예시:

[
  {
    "id": 5,
    "from_line": 10,
    "to_line": 10,
    "applicable": true,
    "applied": false,
    "from_content": "This is an example\n",
    "to_content": "This is an example\n"
  },
  {
    "id": 6,
    "from_line": 19,
    "to_line": 19,
    "applicable": true,
    "applied": false,
    "from_content": "This is another example\n",
    "to_content": "This is another example\n"
  }
]