From 05eb04d749d831412c6d1d5a21070d3ed8a2c5ad Mon Sep 17 00:00:00 2001 From: xiangxinyong Date: Sat, 12 Oct 2019 17:59:14 +0800 Subject: [PATCH] pr merge fuc --- README.md | 1 + api/swagger.yaml | 107 +++++++++++--------- docs/PullRequestMergePutParam.md | 14 +++ docs/PullRequestsApi.md | 18 +--- gitee/api_pull_requests.go | 35 +------ gitee/model_pull_request_merge_put_param.go | 24 +++++ 6 files changed, 103 insertions(+), 96 deletions(-) create mode 100644 docs/PullRequestMergePutParam.md create mode 100644 gitee/model_pull_request_merge_put_param.go diff --git a/README.md b/README.md index ce3f44b..d9c4765 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,7 @@ Class | Method | HTTP request | Description - [PullRequestComments](docs/PullRequestComments.md) - [PullRequestCommits](docs/PullRequestCommits.md) - [PullRequestFiles](docs/PullRequestFiles.md) + - [PullRequestMergePutParam](docs/PullRequestMergePutParam.md) - [PullRequestUpdateParam](docs/PullRequestUpdateParam.md) - [Release](docs/Release.md) - [RepoCommit](docs/RepoCommit.md) diff --git a/api/swagger.yaml b/api/swagger.yaml index c285be1..d7cbfd3 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -4362,13 +4362,6 @@ paths: produces: - "application/json" parameters: - - name: "access_token" - in: "formData" - description: "用户授权码" - required: false - type: "string" - x-exportParamName: "AccessToken" - x-optionalDataType: "String" - name: "owner" in: "path" description: "仓库所属空间地址(企业、组织或个人的地址path)" @@ -4388,39 +4381,13 @@ paths: type: "integer" format: "int32" x-exportParamName: "Number" - - name: "merge_method" - in: "formData" - description: "可选。合并PR的方法,merge(合并所有提交)和 squash(扁平化分支合并)。默认为merge。" - required: false - type: "string" - default: "merge" - enum: - - "merge" - - "squash" - x-exportParamName: "MergeMethod" - x-optionalDataType: "String" - - name: "prune_source_branch" - in: "formData" - description: "可选。合并PR后是否删除源分支,默认false(不删除)" - required: false - type: "boolean" - x-exportParamName: "PruneSourceBranch" - x-optionalDataType: "Bool" - - name: "title" - in: "formData" - description: "可选。合并标题,默认为PR的标题" - required: false - type: "string" - x-exportParamName: "Title" - x-optionalDataType: "String" - - name: "description" - in: "formData" - description: "可选。合并描述,默认为 \"Merge pull request !{pr_id} from {author}/{source_branch}\"\ - ,与页面显示的默认一致。" - required: false - type: "string" - x-exportParamName: "Description" - x-optionalDataType: "String" + - in: "body" + name: "body" + description: "PullRequest合入参数" + required: true + schema: + $ref: "#/definitions/PullRequestMergePutParam" + x-exportParamName: "Body" responses: 200: description: "合并Pull Request" @@ -4723,6 +4690,7 @@ paths: required: true schema: $ref: "#/definitions/PullRequestCommentPostParam" + x-exportParamName: "Body" responses: 201: description: "返回格式" @@ -15976,28 +15944,69 @@ definitions: x-exportParamName: "AccessToken" x-optionalDataType: "String" body: - description: "必填。评论内容" - required: true type: "string" + description: "必填。评论内容" x-exportParamName: "Body" commit_id: - description: "可选。PR代码评论的commit id" - required: false type: "string" + description: "可选。PR代码评论的commit id" x-exportParamName: "CommitId" x-optionalDataType: "String" path: - description: "可选。PR代码评论的文件名" - required: false type: "string" + description: "可选。PR代码评论的文件名" x-exportParamName: "Path" x-optionalDataType: "String" position: - in: "formData" - description: "可选。PR代码评论diff中的行数" - required: false type: "integer" format: "int32" + description: "可选。PR代码评论diff中的行数" x-exportParamName: "Position" x-optionalDataType: "Int32" description: "create pull request comment" + example: + access_token: "access_token" + path: "path" + position: 0 + body: "body" + commit_id: "commit_id" + PullRequestMergePutParam: + type: "object" + properties: + access_token: + type: "string" + description: "用户授权码" + x-exportParamName: "AccessToken" + x-optionalDataType: "String" + merge_method: + type: "string" + description: "可选。合并PR的方法,merge(合并所有提交)和 squash(扁平化分支合并)。默认为merge。" + enum: + - "merge" + - "squash" + default: "merge" + x-exportParamName: "MergeMethod" + x-optionalDataType: "String" + prune_source_branch: + type: "boolean" + description: "可选。合并PR后是否删除源分支,默认false(不删除)" + x-exportParamName: "PruneSourceBranch" + x-optionalDataType: "Bool" + title: + type: "string" + description: "可选。合并标题,默认为PR的标题" + x-exportParamName: "Title" + x-optionalDataType: "String" + description: + type: "string" + description: "可选。合并描述,默认为 \"Merge pull request !{pr_id} from {author}/{source_branch}\"\ + ,与页面显示的默认一致。" + x-exportParamName: "Description" + x-optionalDataType: "String" + description: "merge pull request parameter" + example: + access_token: "access_token" + path: "path" + position: 0 + body: "body" + commit_id: "commit_id" diff --git a/docs/PullRequestMergePutParam.md b/docs/PullRequestMergePutParam.md new file mode 100644 index 0000000..5c9ce8d --- /dev/null +++ b/docs/PullRequestMergePutParam.md @@ -0,0 +1,14 @@ +# PullRequestMergePutParam + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessToken** | **string** | 用户授权码 | [optional] [default to null] +**MergeMethod** | **string** | 可选。合并PR的方法,merge(合并所有提交)和 squash(扁平化分支合并)。默认为merge。 | [optional] [default to null] +**PruneSourceBranch** | **bool** | 可选。合并PR后是否删除源分支,默认false(不删除) | [optional] [default to null] +**Title** | **string** | 可选。合并标题,默认为PR的标题 | [optional] [default to null] +**Description** | **string** | 可选。合并描述,默认为 \"Merge pull request !{pr_id} from {author}/{source_branch}\",与页面显示的默认一致。 | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PullRequestsApi.md b/docs/PullRequestsApi.md index 2619ca4..9e5088e 100644 --- a/docs/PullRequestsApi.md +++ b/docs/PullRequestsApi.md @@ -778,7 +778,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **PutV5ReposOwnerRepoPullsNumberMerge** -> PutV5ReposOwnerRepoPullsNumberMerge(ctx, owner, repo, number, optional) +> PutV5ReposOwnerRepoPullsNumberMerge(ctx, owner, repo, number, body) 合并Pull Request 合并Pull Request @@ -791,21 +791,7 @@ Name | Type | Description | Notes **owner** | **string**| 仓库所属空间地址(企业、组织或个人的地址path) | **repo** | **string**| 仓库路径(path) | **number** | **int32**| 第几个PR,即本仓库PR的序数 | - **optional** | ***PutV5ReposOwnerRepoPullsNumberMergeOpts** | optional parameters | nil if no parameters - -### Optional Parameters -Optional parameters are passed through a pointer to a PutV5ReposOwnerRepoPullsNumberMergeOpts struct - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - - - **accessToken** | **optional.String**| 用户授权码 | - **mergeMethod** | **optional.String**| 可选。合并PR的方法,merge(合并所有提交)和 squash(扁平化分支合并)。默认为merge。 | [default to merge] - **pruneSourceBranch** | **optional.Bool**| 可选。合并PR后是否删除源分支,默认false(不删除) | - **title** | **optional.String**| 可选。合并标题,默认为PR的标题 | - **description** | **optional.String**| 可选。合并描述,默认为 \"Merge pull request !{pr_id} from {author}/{source_branch}\",与页面显示的默认一致。 | + **body** | [**PullRequestMergePutParam**](PullRequestMergePutParam.md)| PullRequest合入参数 | ### Return type diff --git a/gitee/api_pull_requests.go b/gitee/api_pull_requests.go index f37f831..8eb1c32 100644 --- a/gitee/api_pull_requests.go +++ b/gitee/api_pull_requests.go @@ -1963,25 +1963,11 @@ PullRequestsApiService 合并Pull Request * @param owner 仓库所属空间地址(企业、组织或个人的地址path) * @param repo 仓库路径(path) * @param number 第几个PR,即本仓库PR的序数 - * @param optional nil or *PutV5ReposOwnerRepoPullsNumberMergeOpts - Optional Parameters: - * @param "AccessToken" (optional.String) - 用户授权码 - * @param "MergeMethod" (optional.String) - 可选。合并PR的方法,merge(合并所有提交)和 squash(扁平化分支合并)。默认为merge。 - * @param "PruneSourceBranch" (optional.Bool) - 可选。合并PR后是否删除源分支,默认false(不删除) - * @param "Title" (optional.String) - 可选。合并标题,默认为PR的标题 - * @param "Description" (optional.String) - 可选。合并描述,默认为 \"Merge pull request !{pr_id} from {author}/{source_branch}\",与页面显示的默认一致。 + * @param body PullRequest合入参数 */ - -type PutV5ReposOwnerRepoPullsNumberMergeOpts struct { - AccessToken optional.String - MergeMethod optional.String - PruneSourceBranch optional.Bool - Title optional.String - Description optional.String -} - -func (a *PullRequestsApiService) PutV5ReposOwnerRepoPullsNumberMerge(ctx context.Context, owner string, repo string, number int32, localVarOptionals *PutV5ReposOwnerRepoPullsNumberMergeOpts) (*http.Response, error) { +func (a *PullRequestsApiService) PutV5ReposOwnerRepoPullsNumberMerge(ctx context.Context, owner string, repo string, number int32, body PullRequestMergePutParam) (*http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} @@ -2016,21 +2002,8 @@ func (a *PullRequestsApiService) PutV5ReposOwnerRepoPullsNumberMerge(ctx context if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() { - localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MergeMethod.IsSet() { - localVarFormParams.Add("merge_method", parameterToString(localVarOptionals.MergeMethod.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PruneSourceBranch.IsSet() { - localVarFormParams.Add("prune_source_branch", parameterToString(localVarOptionals.PruneSourceBranch.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Title.IsSet() { - localVarFormParams.Add("title", parameterToString(localVarOptionals.Title.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Description.IsSet() { - localVarFormParams.Add("description", parameterToString(localVarOptionals.Description.Value(), "")) - } + // body params + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return nil, err diff --git a/gitee/model_pull_request_merge_put_param.go b/gitee/model_pull_request_merge_put_param.go new file mode 100644 index 0000000..49f1416 --- /dev/null +++ b/gitee/model_pull_request_merge_put_param.go @@ -0,0 +1,24 @@ +/* + * 码云 Open API + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: 5.3.2 + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ + +package gitee + +// merge pull request parameter +type PullRequestMergePutParam struct { + // 用户授权码 + AccessToken string `json:"access_token,omitempty"` + // 可选。合并PR的方法,merge(合并所有提交)和 squash(扁平化分支合并)。默认为merge。 + MergeMethod string `json:"merge_method,omitempty"` + // 可选。合并PR后是否删除源分支,默认false(不删除) + PruneSourceBranch bool `json:"prune_source_branch,omitempty"` + // 可选。合并标题,默认为PR的标题 + Title string `json:"title,omitempty"` + // 可选。合并描述,默认为 \"Merge pull request !{pr_id} from {author}/{source_branch}\",与页面显示的默认一致。 + Description string `json:"description,omitempty"` +} -- GitLab