里程碑接口文档

1. 获取仓库所有里程碑

请求

GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones

参数名描述类型数据类型
access_token用户授权码querystring
owner*仓库所属空间地址(企业、组织或个人的地址path)pathstring
repo*仓库路径(path)pathstring
state里程碑状态: open, closed, all。默认: openquerystring
sort排序方式: due_onquerystring
direction升序(asc)或是降序(desc)。默认: ascquerystring
page当前的页码queryint
per_page每页的数量,最大为 100,默认 20queryint

响应

[
  {
    "closed_issues": 0,
    "created_at": "2024-10-08T10:58:16+08:00",
    "description": "你好中国",
    "due_on": "2024-11-08",
    "number": 4914,
    "open_issues": 0,
    "repository_id": 4066481,
    "state": "active",
    "title": "你好中国",
    "updated_at": "2024-10-08T10:58:16+08:00",
    "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
  }
]

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones?state=open&sort=due_on&direction=asc&page=1&per_page=20&access_token=xxxx'

2. 获取仓库单个里程碑

请求

GET https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones/{number}

参数名描述类型数据类型
access_token用户授权码querystring
owner*仓库所属空间地址(企业、组织或个人的地址path)pathstring
repo*仓库路径(path)pathstring
number*里程碑序列号(number)pathint

响应

{
  "closed_issues": 0,
  "created_at": "2024-10-08T10:58:16+08:00",
  "description": "你好中国",
  "due_on": "2024-11-08",
  "number": 4914,
  "open_issues": 0,
  "repository_id": 4066481,
  "state": "active",
  "title": "你好中国",
  "updated_at": "2024-10-08T10:58:16+08:00",
  "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
}

Demo

curl --location -g --request GET 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones/4914?access_token=xxxx'

3. 删除仓库单个里程碑

请求

DELETE https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones/{number}

参数名描述类型数据类型
access_token用户授权码querystring
owner*仓库所属空间地址(企业、组织或个人的地址path)pathstring
repo*仓库路径(path)pathstring
number*里程碑序列号(number)pathint

响应

Demo

curl --location -g --request DELETE 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones/4914?access_token=xxxx'

4. 更新仓库里程碑

请求

PATCH https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones/{number}

参数名描述类型数据类型
access_token用户授权码querystring
owner*仓库所属空间地址(企业、组织或个人的地址path)pathstring
repo*仓库路径(path)pathstring
number*里程碑序列号(number)pathint
title*里程碑标题bodystring
state里程碑状态: open, closed, all。默认: openbodystring
description里程碑具体描述bodystring
due_on*里程碑的截止日期bodystring

响应

{
  "closed_issues": 0,
  "created_at": "2024-10-08T10:58:16+08:00",
  "description": "你好中国",
  "due_on": "2024-11-08",
  "number": 4914,
  "open_issues": 0,
  "repository_id": 4066481,
  "state": "active",
  "title": "你好中国",
  "updated_at": "2024-10-08T10:58:16+08:00",
  "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
}

Demo

curl --location -g --request PATCH 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones/4914?access_token=xxxx' \
--data-raw '{
    "title": "title",
    "due_on": "2025-01-01"
}'

5. 创建仓库里程碑

请求

POST https://api.gitcode.com/api/v5/repos/{owner}/{repo}/milestones

参数名描述类型数据类型
access_token用户授权码querystring
owner*仓库所属空间地址(企业、组织或个人的地址path)pathstring
repo*仓库路径(path)pathstring
title*里程碑标题bodystring
description里程碑具体描述bodystring
due_on*里程碑的截止日期bodystring

响应

{
  "closed_issues": 0,
  "created_at": "2024-10-08T10:58:16+08:00",
  "description": "你好中国",
  "due_on": "2024-11-08",
  "number": 4914,
  "open_issues": 0,
  "repository_id": 4066481,
  "state": "active",
  "title": "你好中国",
  "updated_at": "2024-10-08T10:58:16+08:00",
  "url": "https://gitcode.com/dengmengmian/oneapi/milestones/1"
}

Demo

curl --location -g --request POST 'https://api.gitcode.com/api/v5/repos/dengmengmian/oneapi/milestones?access_token=xxxx' \
--header 'Content-Type: application/json' \
--data-raw '{
    "title": "title",
    "due_on": "2025-01-01"
}'