변경 제안 API
Tier: Free, Premium, Ultimate
Offering: GitLab.com, Self-managed, GitLab Dedicated
이 페이지에서는 변경 제안 API를 설명합니다.
모든 제안에 대한 API 호출은 인증이 필요합니다.
제안 만들기
API를 통해 제안을 만들려면 Discussion API를 사용하여 병합 요청의 차이에서 새 스레드를 만드세요.
제안의 형식은 다음과 같습니다:
```suggestion:-3+0
example text
```
제안 적용하기
병합 요청에 제안된 패치를 적용합니다. 사용자는 이 작업을 수행하려면 최소한 Developer 역할이 있어야 합니다.
PUT /suggestions/:id/apply
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer | 예 | 제안의 ID |
commit_message |
string | 아니오 | 기본 생성 메시지 대신 사용할 사용자 지정 커밋 메시지 또는 프로젝트의 기본 메시지 |
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "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 eaxmple\n",
"to_content": "This is an example\n"
}
여러 제안 적용하기
PUT /suggestions/batch_apply
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
ids |
integer | 예 | 제안의 ID들 |
commit_message |
string | 아니오 | 기본 생성 메시지 대신 사용할 사용자 지정 커밋 메시지 또는 프로젝트의 기본 메시지 |
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --header 'Content-Type: application/json' --data '{"ids": [5, 6]}' "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 eaxmple\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 eaxmple\n",
"to_content": "This is another example\n"
}
]