Module: JPSClient::API::CommitLog
- Included in:
- Client
- Defined in:
- lib/jpsclient/api/commit_log.rb
Overview
提交记录管理相关 API 处理 /api/commit_log/* 路径的所有接口
Instance Method Summary collapse
-
#get_commit_log_list(params: {}) ⇒ Hash
获取提交记录列表.
-
#get_commit_log_preview(workflowId:, commitIds:, params: {}) ⇒ Hash
预览提交记录.
-
#get_commit_log_simple(commitId:) ⇒ Hash
获取提交记录简要信息.
-
#send_commit_log_message(projectId:, workflowId:, params: {}) ⇒ Hash
发送提交记录消息通知.
-
#update_commit_log(id:, params: {}) ⇒ Hash
更新提交记录.
Instance Method Details
#get_commit_log_list(params: {}) ⇒ Hash
获取提交记录列表
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/jpsclient/api/commit_log.rb', line 119 def get_commit_log_list(params: {}) config = @request_config && @request_config["commit_log_list"] raise JPSClient::ExceptionError, "Missing config for commit_log_list" unless config && config["url"] path = config["url"] get_params = { pageNo: params[:pageNo] || 1, pageSize: params[:pageSize] || 20 } # 添加可选的筛选参数(使用 Array() 支持单个值和数组) get_params[:ids] = Array(params[:ids]).join(',') if params[:ids] get_params[:workflowIds] = Array(params[:workflowIds]).join(',') if params[:workflowIds] get_params[:committers] = Array(params[:committers]).join(',') if params[:committers] get_params[:repoPath] = params[:repoPath] if params[:repoPath] get_params[:keyword] = params[:keyword] if params[:keyword] get_params[:remark] = params[:remark] if params[:remark] get_params[:onlyCliff] = params[:onlyCliff] if params.key?(:onlyCliff) get_params[:personalCenter] = params[:personalCenter] if params.key?(:personalCenter) get_params[:startTimestamp] = params[:startTimestamp] if params[:startTimestamp] get_params[:endTimestamp] = params[:endTimestamp] if params[:endTimestamp] return request_with_auth(:get, path, params: get_params) end |
#get_commit_log_preview(workflowId:, commitIds:, params: {}) ⇒ Hash
预览提交记录
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/jpsclient/api/commit_log.rb', line 88 def get_commit_log_preview(workflowId:, commitIds:, params: {}) config = @request_config && @request_config["commit_log_preview"] raise JPSClient::ExceptionError, "Missing config for commit_log_preview" unless config && config["url"] path = config["url"] get_params = { workflowId: workflowId, commitIds: commitIds.is_a?(Array) ? commitIds.join(',') : commitIds } get_params[:onlyCliff] = params[:onlyCliff] if params.key?(:onlyCliff) return request_with_auth(:get, path, params: get_params) end |
#get_commit_log_simple(commitId:) ⇒ Hash
获取提交记录简要信息
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/jpsclient/api/commit_log.rb', line 69 def get_commit_log_simple(commitId:) config = @request_config && @request_config["commit_log_simple"] raise JPSClient::ExceptionError, "Missing config for commit_log_simple" unless config && config["url"] path = config["url"] get_params = { commitId: commitId } return request_with_auth(:get, path, params: get_params) end |
#send_commit_log_message(projectId:, workflowId:, params: {}) ⇒ Hash
发送提交记录消息通知
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/jpsclient/api/commit_log.rb', line 43 def (projectId:, workflowId:, params: {}) config = @request_config && @request_config["commit_log_send_message"] raise JPSClient::ExceptionError, "Missing config for commit_log_send_message" unless config && config["url"] path = config["url"] body_params = { projectId: projectId, workflowId: workflowId, single: params.fetch(:single, true) } # 添加可选参数 body_params[:branch] = params[:branch] if params[:branch] # 支持单数形式 body_params[:branches] = params[:branches] if params[:branches] # 向后兼容复数形式 body_params[:commitIds] = params[:commitIds] if params[:commitIds] body_params[:startTimestamp] = params[:startTimestamp] if params[:startTimestamp] body_params[:endTimestamp] = params[:endTimestamp] if params[:endTimestamp] body_params[:indexNo] = params[:indexNo] if params[:indexNo] return request_with_auth(:post, path, body: body_params) end |
#update_commit_log(id:, params: {}) ⇒ Hash
更新提交记录
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jpsclient/api/commit_log.rb', line 14 def update_commit_log(id:, params: {}) config = @request_config && @request_config["commit_log_update"] raise JPSClient::ExceptionError, "Missing config for commit_log_update" unless config && config["url"] path = config["url"] body_params = { id: id } # 添加可选参数 body_params[:description] = params[:description] if params.key?(:description) body_params[:fileUrls] = params[:fileUrls] if params[:fileUrls] return request_with_auth(:post, path, body: body_params) end |