diff --git a/Gemfile b/Gemfile
index 37687e78d..3da6f273d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -135,4 +135,4 @@ gem 'doorkeeper'
gem 'doorkeeper-jwt'
-gem 'gitea-client', '~> 0.9.4'
\ No newline at end of file
+gem 'gitea-client', '~> 0.10.2'
\ No newline at end of file
diff --git a/app/controllers/api/v1/projects/commits_controller.rb b/app/controllers/api/v1/projects/commits_controller.rb
index 873dd4d93..a1545ae6f 100644
--- a/app/controllers/api/v1/projects/commits_controller.rb
+++ b/app/controllers/api/v1/projects/commits_controller.rb
@@ -1,5 +1,10 @@
class Api::V1::Projects::CommitsController < Api::V1::BaseController
- before_action :require_public_and_member_above, only: [:diff]
+ before_action :require_public_and_member_above, only: [:index, :diff]
+
+ def index
+ @result_object = Api::V1::Projects::Commits::ListService.call(@project, {page: page, limit: limit, sha: params[:sha]}, current_user&.gitea_token)
+ puts @result_object
+ end
def diff
@result_object = Api::V1::Projects::Commits::DiffService.call(@project, params[:sha], current_user&.gitea_token)
diff --git a/app/controllers/api/v1/projects/contents_controller.rb b/app/controllers/api/v1/projects/contents_controller.rb
new file mode 100644
index 000000000..a4e65051e
--- /dev/null
+++ b/app/controllers/api/v1/projects/contents_controller.rb
@@ -0,0 +1,13 @@
+class Api::V1::Projects::ContentsController < Api::V1::BaseController
+ before_action :require_operate_above, only: [:batch]
+
+ def batch
+ @result_object = Api::V1::Projects::Contents::BatchCreateService.call(@project, batch_content_params, current_user&.gitea_token)
+ puts @result_object
+ end
+
+ private
+ def batch_content_params
+ params.require(:content).permit(:author_email, :author_name, :author_timeunix, :branch, :committer_email, :committer_name, :committer_timeunix, :message, :new_branch, files: [ :action_type, :content, :encoding, :file_path])
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/api/v1/projects_controller.rb b/app/controllers/api/v1/projects_controller.rb
index 0873213de..bc51362ae 100644
--- a/app/controllers/api/v1/projects_controller.rb
+++ b/app/controllers/api/v1/projects_controller.rb
@@ -1,5 +1,5 @@
class Api::V1::ProjectsController < Api::V1::BaseController
- before_action :require_public_and_member_above, only: [:show, :compare]
+ before_action :require_public_and_member_above, only: [:show, :compare, :blame]
def index
render_ok
@@ -12,4 +12,9 @@ class Api::V1::ProjectsController < Api::V1::BaseController
def compare
@result_object = Api::V1::Projects::CompareService.call(@project, params[:from], params[:to], current_user&.gitea_token)
end
+
+ def blame
+ @result_object = Api::V1::Projects::BlameService.call(@project, params[:sha], params[:filepath], current_user&.gitea_token)
+ puts @result_object
+ end
end
\ No newline at end of file
diff --git a/app/docs/slate/source/includes/_repositories.md b/app/docs/slate/source/includes/_repositories.md
index 2b3ca1326..ae74dac7f 100644
--- a/app/docs/slate/source/includes/_repositories.md
+++ b/app/docs/slate/source/includes/_repositories.md
@@ -1093,6 +1093,138 @@ await octokit.request('GET /api/yystopf/ceshi/files.json')
]
```
+## 提交文件到仓库
+提交文件到仓库,支持批量
+
+> 示例:
+
+```shell
+curl -X POST \
+-d "files[][action_type]=create" \
+-d "files[][content]=jfksj" \
+-d "files[][encoding]=text" \
+-d "files[][file_path]=heihei8" \
+-d "author_email=yystopf@163.com" \
+-d "author_name=yystopf" \
+-d "author_timeunix=1658214400" \
+-d "committer_email=yystopf@163.com" \
+-d "committer_name=yystopf" \
+-d "committer_timeunix=1658214400" \
+-d "branch=develop" \
+-d "new_branch=develop_ceshi" \
+-d "message=测试提交" \
+http://localhost:3000/api/v1/yystopf/ceshi/contents/batch.json
+```
+
+```javascript
+await octokit.request('POST /api/v1/yystopf/ceshi/contents/batch.json')
+```
+
+### HTTP 请求
+`POST /api/v1/:owner/:repo/contents/batch`
+
+### 请求参数:
+参数 | 必选 | 默认 | 类型 | 字段说明
+--------- | ------- | ------- | -------- | ----------
+|owner |是| |string |用户登录名 |
+|repo |是| |string |项目标识identifier |
+|files.action_type |是| |string|操作类型 create: 创建 update: 更新 delete: 删除|
+|files.content |是| |string|文件内容|
+|files.encoding |是| |string|文件编码方式 text 文本 base64 加密|
+|files.file_path |是| |string|文件路径|
+|author_email |是| |string|作者邮箱|
+|author_name |是| |string|作者名称|
+|author_timeunix |是| |int|编码时间,精确到秒|
+|committer_email |是| |string|提交者邮箱|
+|committer_name |是| |string|提交者名称|
+|committer_timeunix|是| |int|提交时间戳,精确到秒|
+|branch |是| |string|提交分支|
+|new_branch |否| |string|如果需要创建新分支,这个需要填|
+|message |是| |string|提交信息|
+
+> 请求的JSON示例:
+
+```json
+{
+ "files": [
+ {
+ "action_type": "create",
+ "content": "jfksj",
+ "encoding": "text",
+ "file_path": "heihei7"
+ }
+ ],
+ "author_email": "yystopf@163.com",
+ "author_name": "yystopf",
+ "author_timeunix": 1658214400,
+ "committer_email": "yystopf@163.com",
+ "committer_name": "yystopf",
+ "committer_timeunix": 1658214400,
+ "branch": "hh_ceshi",
+ "message": "测试提交"
+}
+```
+
+### 返回字段说明:
+参数 | 类型 | 字段说明
+--------- | ----------- | -----------
+|commit.sha |string |提交ID|
+|commit.author |object |作者|
+|commit.committer |object |提交者|
+|commit.commit_message|string |提交信息|
+|commit.parent_shas |array |父节点commit ID|
+|commit.authored_time|int |编码时间|
+|commit.commited_time|int |提交时间|
+|contents.name |string |文件名称|
+|contents.path |string |文件路径|
+|contents.sha |string |文件标识|
+|contents.type |string |文件类型|
+|contents.size |int |文件大小|
+|contents.url |string |文件地址|
+|contents.encoding |string |编码类型 text 文本 base64 加密 |
+|contents.content |string |文件内容|
+
+
+> 返回的JSON示例:
+
+```json
+{
+ "commit": {
+ "sha": "7c1e25f9b974e4b7a3816bd7f5e49b441078e999",
+ "author": {
+ "id": "2",
+ "login": "yystopf",
+ "name": "heh",
+ "type": "User",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ },
+ "committer": {
+ "id": "2",
+ "login": "yystopf",
+ "name": "heh",
+ "type": "User",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ },
+ "commit_message": "测试提交\n",
+ "parent_shas": [
+ "9aec816d0f3600082ca77893290a14bd29d805fe"
+ ],
+ "authored_time": 1658214400,
+ "commited_time": 1658214400
+ },
+ "contents": [
+ {
+ "name": "heihei7",
+ "path": "heihei7",
+ "sha": "f0acac8efb3021b0f6a7b13b42d033d86e076a4b",
+ "type": "file",
+ "size": 5,
+ "encoding": "base64",
+ "content": "amZrc2o="
+ }
+ ]
+}
+```
## 获取仓库代码目录
获取仓库代码目录
@@ -1413,6 +1545,89 @@ await octokit.request('GET /api/v1/yystopf/csfjkkj/git/blobs/80dd40214a586223123
Success Data.
+## 获取仓库提交列表
+根据分支名、标签、commit ID来获取提交列表
+
+> 示例:
+
+```shell
+curl -X GET \
+-d "sha=master" \
+-d "page=1" \
+-d "limit=1" \
+http://localhost:3000/api/v1/yystopf/csfjkkj/commits.json
+```
+
+```javascript
+await octokit.request('GET /api/v1/yystopf/csfjkkj/commits.json')
+```
+
+### HTTP 请求
+`GET /api/v1/:owner/:repo/commits.json`
+
+### 请求参数:
+参数 | 必选 | 默认 | 类型 | 字段说明
+--------- | ------- | ------- | -------- | ----------
+|owner|是| | string |用户登录名 |
+|repo |是| | string |项目标识identifier |
+|sha |否| | string |分支名、标签名或Commit ID|
+|page |否| | int |页码|
+|limit|否| | int |每页数量|
+### 返回字段说明:
+参数 | 类型 | 字段说明
+--------- | ----------- | -----------
+|total_count|int|提交总数|
+|commits.sha|string|提交ID|
+|commits.author|object|提交作者|
+|commits.committer|object|提交者|
+|commits.commit_message|string|提交信息|
+|commits.parent_shas|array|提交父节点ID|
+|commits.files|array|提交文件|
+|commits.commit_date|string|提交日期|
+|commits.commit_time|string|提交时间|
+|commits.branch|string|提交分支|
+
+
+> 返回的JSON示例:
+
+```json
+{
+ "total_count": 12,
+ "commits": [
+ {
+ "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "parent_shas": [
+ "411e4d259785241f1bd14faf99ca24fd1b802f2a"
+ ],
+ "files": [
+ "hd.txt"
+ ],
+ "commit_date": "2022-07-05",
+ "commit_time": "2022-07-05 11:00:45",
+ "branch": "hh_ceshi"
+ }
+ ]
+}
+```
+
+
## 获取单个提交的blame信息
根据commit ID获取blame信息
@@ -1531,6 +1746,203 @@ await octokit.request('GET /api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393
Success Data.
+## 获取单个文件的blame信息
+根据分支、标签、commitID获取某个文件的blame信息
+
+> 示例:
+
+```shell
+curl -X GET \
+-d "sha=master" \
+-d "filepath=hd.txt" \
+http://localhost:3000/api/v1/yystopf/csfjkkj/blame.json
+```
+
+```javascript
+await octokit.request('GET /api/v1/yystopf/csfjkkj/blame.json')
+```
+
+### HTTP 请求
+`GET /api/v1/:owner/:repo/blame.json`
+
+### 请求参数:
+参数 | 必选 | 默认 | 类型 | 字段说明
+--------- | ------- | ------- | -------- | ----------
+|owner |是| | string |用户登录名 |
+|repo |是| | string |项目标识identifier |
+|sha |是| | string |分支、标签或提交记录id |
+|filepath|是| | string |文件路径|
+### 返回字段说明:
+参数 | 类型 | 字段说明
+--------- | ----------- | -----------
+|file_size|int|文件大小|
+|file_name|string|文件名称|
+|num_lines|int|文件总行数|
+|blame_parts.commit|object|提交|
+|blame_parts.current_number|int|当前行数|
+|blame_parts.effect_line|int|影响的行数|
+|blame_parts.lines|array|行内容|
+
+> 返回的JSON示例:
+
+```json
+{
+ "file_size": 32,
+ "file_name": "hd.txt",
+ "num_lines": 12,
+ "blame_parts": [
+ {
+ "commit": {
+ "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-04 18:41:25",
+ "committed_time": "2022-07-04 18:41:25",
+ "created_time": "2022-07-04 18:41:25"
+ },
+ "current_number": 1,
+ "effect_line": 5,
+ "lines": [
+ "dkfj",
+ "s",
+ "324",
+ "234",
+ "2"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-05 11:00:45",
+ "committed_time": "2022-07-05 11:00:45",
+ "created_time": "2022-07-05 11:00:45"
+ },
+ "current_number": 6,
+ "effect_line": 1,
+ "lines": [
+ "dd"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-04 18:41:25",
+ "committed_time": "2022-07-04 18:41:25",
+ "created_time": "2022-07-04 18:41:25"
+ },
+ "current_number": 7,
+ "effect_line": 3,
+ "lines": [
+ "23",
+ "4",
+ "23"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-05 11:00:45",
+ "committed_time": "2022-07-05 11:00:45",
+ "created_time": "2022-07-05 11:00:45"
+ },
+ "current_number": 10,
+ "effect_line": 1,
+ "lines": [
+ "s1"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-04 18:41:25",
+ "committed_time": "2022-07-04 18:41:25",
+ "created_time": "2022-07-04 18:41:25"
+ },
+ "current_number": 11,
+ "effect_line": 1,
+ "lines": [
+ ""
+ ]
+ }
+ ]
+}
+```
+
## 获取比较提交blame
根据分支名、标签、commit ID来获取代码对比blame
diff --git a/app/services/api/v1/projects/blame_service.rb b/app/services/api/v1/projects/blame_service.rb
new file mode 100644
index 000000000..d419fec14
--- /dev/null
+++ b/app/services/api/v1/projects/blame_service.rb
@@ -0,0 +1,38 @@
+class Api::V1::Projects::BlameService < ApplicationService
+ include ActiveModel::Model
+
+ attr_reader :project, :sha, :filepath, :owner, :repo, :token
+ attr_accessor :gitea_data
+
+ validates :sha, :filepath, presence: true
+
+ def initialize(project, sha, filepath, token=nil)
+ @project = project
+ @owner = project&.owner.login
+ @repo = project&.identifier
+ @sha = sha
+ @filepath = filepath
+ @token = token
+ end
+
+ def call
+ raise Error, errors.full_messages.join(",") unless valid?
+ load_gitea_data
+
+ gitea_data
+ end
+
+ private
+ def request_params
+ {
+ access_token: token,
+ sha: sha,
+ filepath: filepath
+ }
+ end
+
+ def load_gitea_data
+ @gitea_data = $gitea_client.get_repos_blame_by_owner_repo(owner, repo, {query: request_params})
+ raise Error, '获取项目blame失败!' unless @gitea_data.is_a?(Hash)
+ end
+end
\ No newline at end of file
diff --git a/app/services/api/v1/projects/branches/create_service.rb b/app/services/api/v1/projects/branches/create_service.rb
index 33e561270..2837dfcf4 100644
--- a/app/services/api/v1/projects/branches/create_service.rb
+++ b/app/services/api/v1/projects/branches/create_service.rb
@@ -44,7 +44,7 @@ class Api::V1::Projects::Branches::CreateService < ApplicationService
end
def check_new_branch_exist
- result = $gitea_client.get_repos_branch_name_set_by_owner_repo(owner, repo) rescue nil
+ result = $gitea_client.get_repos_branch_name_set_by_owner_repo(owner, repo, {query: request_params}) rescue nil
raise Error, '查询分支名称失败!' unless result.is_a?(Hash)
raise Error, '分支已存在!' if result['branch_name'].include?(@new_branch_name)
end
diff --git a/app/services/api/v1/projects/commits/list_service.rb b/app/services/api/v1/projects/commits/list_service.rb
new file mode 100644
index 000000000..17818554c
--- /dev/null
+++ b/app/services/api/v1/projects/commits/list_service.rb
@@ -0,0 +1,38 @@
+class Api::V1::Projects::Commits::ListService < ApplicationService
+
+ attr_reader :project, :sha, :page, :limit, :owner, :repo, :token
+ attr_accessor :gitea_data
+
+ def initialize(project, params, token=nil)
+ @project = project
+ @sha = params[:sha]
+ @page = params[:page] || 1
+ @limit = params[:limit] || 15
+ @owner = project&.owner.login
+ @repo = project&.identifier
+ @token = token
+ end
+
+ def call
+ load_gitea_data
+
+ gitea_data
+ end
+
+ private
+ def request_params
+ param = {
+ access_token: token,
+ page: page,
+ limit: limit
+ }
+ param.merge!(sha: sha) if sha.present?
+
+ param
+ end
+
+ def load_gitea_data
+ @gitea_data = $gitea_client.get_repos_commits_by_owner_repo(owner, repo, {query: request_params}) rescue nil
+ raise Error, '获取提交列表失败!' unless @gitea_data.is_a?(Hash)
+ end
+end
\ No newline at end of file
diff --git a/app/services/api/v1/projects/contents/batch_create_service.rb b/app/services/api/v1/projects/contents/batch_create_service.rb
new file mode 100644
index 000000000..d987f9318
--- /dev/null
+++ b/app/services/api/v1/projects/contents/batch_create_service.rb
@@ -0,0 +1,91 @@
+class Api::V1::Projects::Contents::BatchCreateService < ApplicationService
+ include ActiveModel::Model
+
+ attr_reader :project, :owner, :repo, :token
+ attr_reader :files, :author_email, :author_name, :author_timeunix, :branch, :committer_email, :committer_name, :committer_timeunix, :message, :new_branch
+ attr_accessor :gitea_data
+
+ validates :author_email, :committer_email, presence: true, format: { with: CustomRegexp::EMAIL }
+ validates :author_name, :committer_name, presence: true, format: { with: /\A(?!_)(?!.*?_$)[a-zA-Z0-9_-]{4,15}\z/ }
+ validates :author_timeunix, :committer_timeunix, presence: true
+ validates :branch, presence: true
+ validates :message, presence: true
+
+
+ def initialize(project, params, token=nil)
+ puts params
+ @project = project
+ @owner = project&.owner.login
+ @repo = project&.identifier
+ @token = token
+ @files = params[:files]
+ @author_email = params[:author_email]
+ @author_name = params[:author_name]
+ @author_timeunix = params[:author_timeunix]
+ @branch = params[:branch]
+ @committer_email = params[:committer_email]
+ @committer_name = params[:committer_name]
+ @committer_timeunix = params[:committer_timeunix]
+ @message = params[:message]
+ @new_branch = params[:new_branch]
+ end
+
+ def call
+ raise Error, '请输入正确的文件参数Files' unless valid_files?
+ raise Error, errors.full_messages.join(", ") unless valid?
+ check_branch_exist
+ excute_data_to_gitea
+
+ gitea_data
+ end
+
+ private
+ def request_params
+ {
+ access_token: token
+ }
+ end
+
+ def request_body
+ {
+ files: files,
+ header: {
+ author: {
+ email: author_email,
+ name: author_name
+ },
+ committer: {
+ email: committer_email,
+ name: committer_name
+ },
+ dates: {
+ author: Time.at(author_timeunix.to_i),
+ committer: Time.at(committer_timeunix.to_i)
+ },
+ message: message,
+ new_branch: new_branch,
+ signoff: false
+ }
+ }
+ end
+
+ def valid_files?
+ return false unless files.is_a?(Array) && !files.blank?
+ files.each do |file|
+ return false unless file.has_key?(:action_type) && file.has_key?(:content) && file.has_key?(:encoding) && file.has_key?(:file_path)
+ end
+ end
+
+ def excute_data_to_gitea
+ @gitea_data = $gitea_client.post_repos_contents_batch_by_owner_repo(owner, repo, {body: request_body.to_json, query: request_params}) rescue nil
+ raise Error, '创建文件失败!' unless @gitea_data.is_a?(Hash)
+ end
+
+ def check_branch_exist
+ result = $gitea_client.get_repos_branch_name_set_by_owner_repo(owner, repo, {query: request_params} ) rescue nil
+ raise Error, '查询分支名称失败!' unless result.is_a?(Hash)
+ raise Error, '分支不存在!' unless result['branch_name'].include?(branch)
+ raise Error, '分支已存在!' if result['branch_name'].include?(new_branch) && new_branch.nil?
+ end
+
+end
\ No newline at end of file
diff --git a/app/views/api/v1/projects/blame.json.jbuilder b/app/views/api/v1/projects/blame.json.jbuilder
new file mode 100644
index 000000000..8dfa6c8a4
--- /dev/null
+++ b/app/views/api/v1/projects/blame.json.jbuilder
@@ -0,0 +1,22 @@
+json.file_size @result_object['file_size']
+json.file_name @result_object['file_name']
+json.num_lines @result_object['num_lines']
+json.blame_parts @result_object['blame_parts'] do |part|
+ json.commit do
+ json.sha part['commit']['id']
+ json.author do
+ json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(part['commit']['author']), name: part['commit']['author']['Name'] }
+ end
+
+ json.committer do
+ json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(part['commit']['commiter']), name: part['commit']['commiter']['Name'] }
+ end
+ json.commit_message part['commit']['commit_message']
+ json.authored_time render_unix_time(part['commit']['authored_time'])
+ json.committed_time render_unix_time(part['commit']['committed_time'])
+ json.created_time render_unix_time(part['commit']['created_time'])
+ end
+ json.current_number part['current_number']
+ json.effect_line part['effect_line']
+ json.lines part['lines']
+end
\ No newline at end of file
diff --git a/app/views/api/v1/projects/commits/_simple_gitea_detail.json.jbuilder b/app/views/api/v1/projects/commits/_simple_gitea_detail.json.jbuilder
new file mode 100644
index 000000000..36e3cc160
--- /dev/null
+++ b/app/views/api/v1/projects/commits/_simple_gitea_detail.json.jbuilder
@@ -0,0 +1,10 @@
+json.sha commit['sha']
+json.author do
+ json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['author']), name: commit['author']['name'] }
+end
+
+json.committer do
+ json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['committer']), name: commit['committer']['name'] }
+end
+json.commit_message commit['message']
+json.parent_shas commit['parents'].map{|x|x['sha']}
\ No newline at end of file
diff --git a/app/views/api/v1/projects/commits/index.json.jbuilder b/app/views/api/v1/projects/commits/index.json.jbuilder
new file mode 100644
index 000000000..bd085535c
--- /dev/null
+++ b/app/views/api/v1/projects/commits/index.json.jbuilder
@@ -0,0 +1,17 @@
+json.total_count @result_object[:total_data].to_i
+json.commits @result_object[:data].each do |commit|
+ json.sha commit['sha']
+ json.author do
+ json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['commit']['author']), name: commit['commit']['author']['name'] }
+ end
+
+ json.committer do
+ json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(commit['commit']['committer']), name: commit['commit']['committer']['name'] }
+ end
+ json.commit_message commit['commit']['message']
+ json.parent_shas commit['parents'].map{|x|x['sha']}
+ json.files commit['files'].map{|f|f['filename']}
+ json.commit_date commit['commit_date']
+ json.commit_time render_unix_time(commit['commit']['committer']['date'])
+ json.branch commit['branch']
+end
\ No newline at end of file
diff --git a/app/views/api/v1/projects/contents/batch.json.jbuilder b/app/views/api/v1/projects/contents/batch.json.jbuilder
new file mode 100644
index 000000000..a9ef08fa6
--- /dev/null
+++ b/app/views/api/v1/projects/contents/batch.json.jbuilder
@@ -0,0 +1,14 @@
+json.commit do
+ json.partial! "api/v1/projects/commits/simple_gitea_detail", commit: @result_object['commit']
+ json.authored_time render_unix_time(@result_object['commit']['author']['date'])
+ json.commited_time render_unix_time(@result_object['commit']['committer']['date'])
+end
+json.contents @result_object['contents'].each do |content|
+ json.name content['name']
+ json.path content['path']
+ json.sha content['sha']
+ json.type content['type']
+ json.size content['size']
+ json.encoding content['encoding']
+ json.content content['content']
+end
\ No newline at end of file
diff --git a/config/routes/api.rb b/config/routes/api.rb
index fc07a9862..81668804e 100644
--- a/config/routes/api.rb
+++ b/config/routes/api.rb
@@ -12,6 +12,7 @@ defaults format: :json do
resource :projects, path: '/', only: [:show, :update, :edit, :destroy] do
collection do
get :compare
+ get :blame
end
end
@@ -32,10 +33,16 @@ defaults format: :json do
get :all
end
end
-
+ resources :commits, only: [:index]
get '/commits/:sha/diff', to: 'commits#diff'
get '/git/blobs/:sha', to: 'git#blobs'
get '/git/trees/:sha', to: 'git#trees'
+
+ resources :contents, only: [:index] do
+ collection do
+ post :batch
+ end
+ end
end
end
diff --git a/public/docs/api.html b/public/docs/api.html
index 02be1cca5..80b1ebdcb 100644
--- a/public/docs/api.html
+++ b/public/docs/api.html
@@ -538,6 +538,9 @@
获取仓库所有文件
+
+ 提交文件到仓库
+
获取仓库代码目录
@@ -553,11 +556,17 @@
获取仓库blobs内容
+
+ 获取仓库提交列表
+
获取单个提交的blame信息
- 获取比较提交blame
+ 获取单个文件的blame信息
+
+
+ 获取比较提交blame
获取仓库webhooks列表
@@ -9070,6 +9079,292 @@ http://localhost:3000/api/yystopf/ceshi/files.json
"html_url": "http://localhost:10080/yystopf/ceshi/src/branch/master/README.md"
}
]
+提交文件到仓库
+提交文件到仓库,支持批量
+
+
+示例:
+
+curl -X POST \
+-d "files[][action_type]=create" \
+-d "files[][content]=jfksj" \
+-d "files[][encoding]=text" \
+-d "files[][file_path]=heihei8" \
+-d "author_email=yystopf@163.com" \
+-d "author_name=yystopf" \
+-d "author_timeunix=1658214400" \
+-d "committer_email=yystopf@163.com" \
+-d "committer_name=yystopf" \
+-d "committer_timeunix=1658214400" \
+-d "branch=develop" \
+-d "new_branch=develop_ceshi" \
+-d "message=测试提交" \
+http://localhost:3000/api/v1/yystopf/ceshi/contents/batch.json
+
await octokit.request('POST /api/v1/yystopf/ceshi/contents/batch.json')
+
HTTP 请求
+POST /api/v1/:owner/:repo/contents/batch
+请求参数:
+
+
+参数 |
+必选 |
+默认 |
+类型 |
+字段说明 |
+
+
+
+owner |
+是 |
+ |
+string |
+用户登录名 |
+
+
+repo |
+是 |
+ |
+string |
+项目标识identifier |
+
+
+files.action_type |
+是 |
+ |
+string |
+操作类型 create: 创建 update: 更新 delete: 删除 |
+
+
+files.content |
+是 |
+ |
+string |
+文件内容 |
+
+
+files.encoding |
+是 |
+ |
+string |
+文件编码方式 text 文本 base64 加密 |
+
+
+files.file_path |
+是 |
+ |
+string |
+文件路径 |
+
+
+author_email |
+是 |
+ |
+string |
+作者邮箱 |
+
+
+author_name |
+是 |
+ |
+string |
+作者名称 |
+
+
+author_timeunix |
+是 |
+ |
+int |
+编码时间,精确到秒 |
+
+
+committer_email |
+是 |
+ |
+string |
+提交者邮箱 |
+
+
+committer_name |
+是 |
+ |
+string |
+提交者名称 |
+
+
+committer_timeunix |
+是 |
+ |
+int |
+提交时间戳,精确到秒 |
+
+
+branch |
+是 |
+ |
+string |
+提交分支 |
+
+
+new_branch |
+否 |
+ |
+string |
+如果需要创建新分支,这个需要填 |
+
+
+message |
+是 |
+ |
+string |
+提交信息 |
+
+
+
+
+请求的JSON示例:
+
+{
+ "files": [
+ {
+ "action_type": "create",
+ "content": "jfksj",
+ "encoding": "text",
+ "file_path": "heihei7"
+ }
+ ],
+ "author_email": "yystopf@163.com",
+ "author_name": "yystopf",
+ "author_timeunix": 1658214400,
+ "committer_email": "yystopf@163.com",
+ "committer_name": "yystopf",
+ "committer_timeunix": 1658214400,
+ "branch": "hh_ceshi",
+ "message": "测试提交"
+}
+
返回字段说明:
+
+
+参数 |
+类型 |
+字段说明 |
+
+
+
+commit.sha |
+string |
+提交ID |
+
+
+commit.author |
+object |
+作者 |
+
+
+commit.committer |
+object |
+提交者 |
+
+
+commit.commit_message |
+string |
+提交信息 |
+
+
+commit.parent_shas |
+array |
+父节点commit ID |
+
+
+commit.authored_time |
+int |
+编码时间 |
+
+
+commit.commited_time |
+int |
+提交时间 |
+
+
+contents.name |
+string |
+文件名称 |
+
+
+contents.path |
+string |
+文件路径 |
+
+
+contents.sha |
+string |
+文件标识 |
+
+
+contents.type |
+string |
+文件类型 |
+
+
+contents.size |
+int |
+文件大小 |
+
+
+contents.url |
+string |
+文件地址 |
+
+
+contents.encoding |
+string |
+编码类型 text 文本 base64 加密 |
+
+
+contents.content |
+string |
+文件内容 |
+
+
+
+
+返回的JSON示例:
+
+{
+ "commit": {
+ "sha": "7c1e25f9b974e4b7a3816bd7f5e49b441078e999",
+ "author": {
+ "id": "2",
+ "login": "yystopf",
+ "name": "heh",
+ "type": "User",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ },
+ "committer": {
+ "id": "2",
+ "login": "yystopf",
+ "name": "heh",
+ "type": "User",
+ "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
+ },
+ "commit_message": "测试提交\n",
+ "parent_shas": [
+ "9aec816d0f3600082ca77893290a14bd29d805fe"
+ ],
+ "authored_time": 1658214400,
+ "commited_time": 1658214400
+ },
+ "contents": [
+ {
+ "name": "heihei7",
+ "path": "heihei7",
+ "sha": "f0acac8efb3021b0f6a7b13b42d033d86e076a4b",
+ "type": "file",
+ "size": 5,
+ "encoding": "base64",
+ "content": "amZrc2o="
+ }
+ ]
+}
获取仓库代码目录
获取仓库代码目录
@@ -9080,9 +9375,9 @@ http://localhost:3000/api/yystopf/ceshi/files.json
-d "ref=develop" \
http://localhost:3000//api/jasder/jasder_test/entries.json
await octokit.request('GET /api/jasder/jasder_test/entries.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/entries.json
-请求参数:
+请求参数:
参数 |
@@ -9114,7 +9409,7 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
分支名称、tag名称或是提交记录id,默认为master分支 |
-返回字段说明:
+返回字段说明:
参数 |
@@ -9228,9 +9523,9 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
-d "filepath=file" \
http://localhost:3000//api/jasder/jasder_test/sub_entries.json
await octokit.request('GET /api/jasder/jasder_test/sub_entries.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/sub_entries.json
-请求参数:
+请求参数:
参数 |
@@ -9269,7 +9564,7 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
分支名称、tag名称或是提交记录id,默认为master分支 |
-返回字段说明:
+返回字段说明:
参数 |
@@ -9366,9 +9661,9 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
-d "filepath=lib" \
http://localhost:3000/api/yystopf/csfjkkj/readme.json
await octokit.request('GET /api/yystopf/csfjkkj/readme.json')
-
HTTP 请求
+HTTP 请求
GET /api/:owner/:repo/readme.json
-请求参数:
+请求参数:
参数 |
@@ -9407,7 +9702,7 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json
子目录名称,默认为空 |
-返回字段说明:
+返回字段说明:
参数 |
@@ -9480,9 +9775,9 @@ http://localhost:3000/api/yystopf/csfjkkj/readme.json
-d "limit=1" \
http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae693756a4781fab2.json
await octokit.request('GET /api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae693756a4781fab2.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/git/trees/:sha.json
-请求参数:
+请求参数:
参数 |
@@ -9535,7 +9830,7 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
分页个数 |
-返回字段说明:
+返回字段说明:
参数 |
@@ -9608,9 +9903,9 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
curl -X GET http://localhost:3000/api/v1/yystopf/csfjkkj/git/blobs/80dd40214a58622312393b2ae693756a4781fab2.json
await octokit.request('GET /api/v1/yystopf/csfjkkj/git/blobs/80dd40214a58622312393b2ae693756a4781fab2.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/git/blobs/:sha.json
-请求参数:
+请求参数:
参数 |
@@ -9642,7 +9937,7 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
提交记录id |
-返回字段说明:
+返回字段说明:
参数 |
@@ -9685,6 +9980,165 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
+获取仓库提交列表
+根据分支名、标签、commit ID来获取提交列表
+
+
+示例:
+
+curl -X GET \
+-d "sha=master" \
+-d "page=1" \
+-d "limit=1" \
+http://localhost:3000/api/v1/yystopf/csfjkkj/commits.json
+
await octokit.request('GET /api/v1/yystopf/csfjkkj/commits.json')
+
HTTP 请求
+GET /api/v1/:owner/:repo/commits.json
+请求参数:
+
+
+参数 |
+必选 |
+默认 |
+类型 |
+字段说明 |
+
+
+
+owner |
+是 |
+ |
+string |
+用户登录名 |
+
+
+repo |
+是 |
+ |
+string |
+项目标识identifier |
+
+
+sha |
+否 |
+ |
+string |
+分支名、标签名或Commit ID |
+
+
+page |
+否 |
+ |
+int |
+页码 |
+
+
+limit |
+否 |
+ |
+int |
+每页数量 |
+
+
+返回字段说明:
+
+
+参数 |
+类型 |
+字段说明 |
+
+
+
+total_count |
+int |
+提交总数 |
+
+
+commits.sha |
+string |
+提交ID |
+
+
+commits.author |
+object |
+提交作者 |
+
+
+commits.committer |
+object |
+提交者 |
+
+
+commits.commit_message |
+string |
+提交信息 |
+
+
+commits.parent_shas |
+array |
+提交父节点ID |
+
+
+commits.files |
+array |
+提交文件 |
+
+
+commits.commit_date |
+string |
+提交日期 |
+
+
+commits.commit_time |
+string |
+提交时间 |
+
+
+commits.branch |
+string |
+提交分支 |
+
+
+
+
+返回的JSON示例:
+
+{
+ "total_count": 12,
+ "commits": [
+ {
+ "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "parent_shas": [
+ "411e4d259785241f1bd14faf99ca24fd1b802f2a"
+ ],
+ "files": [
+ "hd.txt"
+ ],
+ "commit_date": "2022-07-05",
+ "commit_time": "2022-07-05 11:00:45",
+ "branch": "hh_ceshi"
+ }
+ ]
+}
+
+
获取单个提交的blame信息
根据commit ID获取blame信息
@@ -9693,9 +10147,9 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
curl -X GET http://localhost:3000/api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393b2ae693756a4781fab2/diff.json
await octokit.request('GET /api/v1/yystopf/csfjkkj/commits/80dd40214a58622312393b2ae693756a4781fab2/diff.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/commits/:sha/diff.json
-请求参数:
+请求参数:
参数 |
@@ -9727,7 +10181,7 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
提交记录id |
-返回字段说明:
+返回字段说明:
参数 |
@@ -9942,7 +10396,264 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
-获取比较提交blame
+获取单个文件的blame信息
+根据分支、标签、commitID获取某个文件的blame信息
+
+
+示例:
+
+curl -X GET \
+-d "sha=master" \
+-d "filepath=hd.txt" \
+http://localhost:3000/api/v1/yystopf/csfjkkj/blame.json
+
await octokit.request('GET /api/v1/yystopf/csfjkkj/blame.json')
+
HTTP 请求
+GET /api/v1/:owner/:repo/blame.json
+请求参数:
+
+
+参数 |
+必选 |
+默认 |
+类型 |
+字段说明 |
+
+
+
+owner |
+是 |
+ |
+string |
+用户登录名 |
+
+
+repo |
+是 |
+ |
+string |
+项目标识identifier |
+
+
+sha |
+是 |
+ |
+string |
+分支、标签或提交记录id |
+
+
+filepath |
+是 |
+ |
+string |
+文件路径 |
+
+
+返回字段说明:
+
+
+参数 |
+类型 |
+字段说明 |
+
+
+
+file_size |
+int |
+文件大小 |
+
+
+file_name |
+string |
+文件名称 |
+
+
+num_lines |
+int |
+文件总行数 |
+
+
+blame_parts.commit |
+object |
+提交 |
+
+
+blame_parts.current_number |
+int |
+当前行数 |
+
+
+blame_parts.effect_line |
+int |
+影响的行数 |
+
+
+blame_parts.lines |
+array |
+行内容 |
+
+
+
+
+返回的JSON示例:
+
+{
+ "file_size": 32,
+ "file_name": "hd.txt",
+ "num_lines": 12,
+ "blame_parts": [
+ {
+ "commit": {
+ "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-04 18:41:25",
+ "committed_time": "2022-07-04 18:41:25",
+ "created_time": "2022-07-04 18:41:25"
+ },
+ "current_number": 1,
+ "effect_line": 5,
+ "lines": [
+ "dkfj",
+ "s",
+ "324",
+ "234",
+ "2"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-05 11:00:45",
+ "committed_time": "2022-07-05 11:00:45",
+ "created_time": "2022-07-05 11:00:45"
+ },
+ "current_number": 6,
+ "effect_line": 1,
+ "lines": [
+ "dd"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-04 18:41:25",
+ "committed_time": "2022-07-04 18:41:25",
+ "created_time": "2022-07-04 18:41:25"
+ },
+ "current_number": 7,
+ "effect_line": 3,
+ "lines": [
+ "23",
+ "4",
+ "23"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "86c62a1e91c07b58b8aa6c89b94856d89c0f7e55",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-05 11:00:45",
+ "committed_time": "2022-07-05 11:00:45",
+ "created_time": "2022-07-05 11:00:45"
+ },
+ "current_number": 10,
+ "effect_line": 1,
+ "lines": [
+ "s1"
+ ]
+ },
+ {
+ "commit": {
+ "sha": "40f76e80bf5bc41fcc94c28ca8a6eab506c15215",
+ "author": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "committer": {
+ "id": null,
+ "login": "viletyy",
+ "name": "viletyy",
+ "type": null,
+ "image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
+ },
+ "commit_message": "fix\n",
+ "authored_time": "2022-07-04 18:41:25",
+ "committed_time": "2022-07-04 18:41:25",
+ "created_time": "2022-07-04 18:41:25"
+ },
+ "current_number": 11,
+ "effect_line": 1,
+ "lines": [
+ ""
+ ]
+ }
+ ]
+}
+
+
+获取比较提交blame
根据分支名、标签、commit ID来获取代码对比blame
@@ -9953,9 +10664,9 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/git/trees/80dd40214a58622312393b2ae
-d "to=master" \
http://localhost:3000/api/v1/yystopf/csfjkkj/compare.json
await octokit.request('GET /api/v1/yystopf/csfjkkj/compare.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/compare.json
-请求参数:
+请求参数:
参数 |
@@ -9994,7 +10705,7 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/compare.json
目标分支、标签、commitID |
-返回字段说明:
+返回字段说明:
参数 |
@@ -10279,9 +10990,9 @@ http://localhost:3000/api/v1/yystopf/csfjkkj/compare.json
curl -X GET \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/webhooks.json
-请求参数:
+请求参数:
参数 |
@@ -10306,7 +11017,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
项目标识identifier |
-返回字段说明:
+返回字段说明:
参数 |
@@ -10399,9 +11110,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
curl -X GET \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/webhooks/:id.json
-请求参数:
+请求参数:
参数 |
@@ -10433,7 +11144,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
webhook ID |
-返回字段说明:
+返回字段说明:
参数 |
@@ -10556,9 +11267,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3.json
curl -X POST \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
await octokit.request('POST /api/v1/yystopf/ceshi/webhooks.json')
-
HTTP 请求
+HTTP 请求
POST /api/v1/:owner/:repo/webhooks.json
-请求参数:
+请求参数:
参数 |
@@ -10683,7 +11394,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
"branch_filter": "*",
"events": ["push"]
}
-返回字段说明:
+返回字段说明:
参数 |
@@ -10762,9 +11473,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks.json
curl -X PATCH \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
await octokit.request('PATCH /api/v1/yystopf/ceshi/webhooks/7.json')
-
HTTP 请求
+HTTP 请求
PATCH /api/v1/:owner/:repo/webhooks/68.json
-请求参数:
+请求参数:
参数 |
@@ -10896,7 +11607,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
"branch_filter": "*",
"events": ["push"]
}
-返回字段说明:
+返回字段说明:
返回的JSON示例:
@@ -10931,9 +11642,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
curl -X DELETE \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
await octokit.request('DELETE /api/v1/yystopf/ceshi/webhooks/7.json')
-
HTTP 请求
+HTTP 请求
DELETE /api/v1/:owner/:repo/webhooks/:id.json
-请求参数:
+请求参数:
参数 |
@@ -10965,7 +11676,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
webhook id |
-返回字段说明:
+返回字段说明:
返回的JSON示例:
@@ -10986,9 +11697,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/7.json
curl -X GET \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
await octokit.request('GET /api/v1/yystopf/ceshi/webhooks/3/hooktasks.json')
-
HTTP 请求
+HTTP 请求
GET /api/v1/:owner/:repo/webhooks/:id/hooktasks.json
-请求参数:
+请求参数:
参数 |
@@ -11020,7 +11731,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
webhook ID |
-返回字段说明:
+返回字段说明:
参数 |
@@ -11257,9 +11968,9 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/hooktasks.json
curl -X POST \
http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/tests.json
await octokit.request('POST /api/v1/yystopf/ceshi/webhooks/3/tests.json')
-
HTTP 请求
+HTTP 请求
POST /api/v1/:owner/:repo/webhooks/:id/tests.json
-请求参数:
+请求参数:
参数 |
@@ -11291,7 +12002,7 @@ http://localhost:3000/api/v1/yystopf/ceshi/webhooks/3/tests.json
webhook ID |
-返回字段说明:
+返回字段说明:
返回的JSON示例: