diff --git a/README.md b/README.md index 5eb52318a7e7e66666bd2910afcb63f4e4b13662..6d07beac83ba6a36509cd556e416b49a06e4c50d 100644 --- a/README.md +++ b/README.md @@ -265,6 +265,7 @@ Class | Method | HTTP request | Description - [Content](docs/Content.md) - [ContentBasic](docs/ContentBasic.md) - [Contributor](docs/Contributor.md) + - [CreatePullRequestParam](docs/CreatePullRequestParam.md) - [Email](docs/Email.md) - [EnterpriseBasic](docs/EnterpriseBasic.md) - [EnterpriseMember](docs/EnterpriseMember.md) diff --git a/api/swagger.yaml b/api/swagger.yaml index fa91b0df359a03d63c0dfeb7953cdab3fa724052..6a97913ad13ae3af943aaf88dac640aadaf0b685 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -3823,13 +3823,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)" @@ -3842,74 +3835,12 @@ paths: required: true type: "string" x-exportParamName: "Repo" - - name: "title" - in: "formData" - description: "必填。Pull Request 标题" - required: true - type: "string" - x-exportParamName: "Title" - - name: "head" - in: "formData" - description: "必填。Pull Request 提交的源分支。格式:branch 或者:username:branch" - required: true - type: "string" - x-exportParamName: "Head" - - name: "base" - in: "formData" - description: "必填。Pull Request 提交目标分支的名称" - required: true - type: "string" - x-exportParamName: "Base" - name: "body" - in: "formData" - description: "可选。Pull Request 内容" - required: false - type: "string" - x-exportParamName: "Body" - x-optionalDataType: "String" - - name: "milestone_number" - in: "formData" - description: "可选。里程碑序号(id)" - required: false - type: "integer" - format: "int32" - x-exportParamName: "MilestoneNumber" - x-optionalDataType: "Int32" - - name: "labels" - in: "formData" - description: "用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance" - required: false - type: "string" - x-exportParamName: "Labels" - x-optionalDataType: "String" - - name: "issue" - in: "formData" - description: "可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充" - required: false - type: "string" - x-exportParamName: "Issue" - x-optionalDataType: "String" - - name: "assignees" - in: "formData" - description: "可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2)" - required: false - type: "string" - x-exportParamName: "Assignees" - x-optionalDataType: "String" - - name: "testers" - in: "formData" - description: "可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2)" - required: false - type: "string" - x-exportParamName: "Testers" - x-optionalDataType: "String" - - name: "prune_source_branch" - in: "formData" - description: "可选。合并PR后是否删除源分支,默认false(不删除)" - required: false - type: "boolean" - x-exportParamName: "PruneSourceBranch" - x-optionalDataType: "Bool" + in: "body" + description: "pr的信息" + required: true + schema: + $ref: "#/definitions/CreatePullRequestParam" responses: 201: description: "返回格式" @@ -14216,6 +14147,74 @@ definitions: site_admin: "site_admin" id: 0 organizations_url: "organizations_url" + CreatePullRequestParam: + type: "object" + properties: + access_token: + description: "用户授权码" + required: false + type: "string" + x-exportParamName: "AccessToken" + x-optionalDataType: "String" + title: + description: "必填。Pull Request 标题" + required: true + type: "string" + x-exportParamName: "Title" + head: + description: "必填。Pull Request 提交的源分支。格式:branch 或者:username:branch" + required: true + type: "string" + x-exportParamName: "Head" + base: + description: "必填。Pull Request 提交目标分支的名称" + required: true + type: "string" + x-exportParamName: "Base" + body: + description: "可选。Pull Request 内容" + required: false + type: "string" + x-exportParamName: "Body" + x-optionalDataType: "String" + milestone_number: + description: "可选。里程碑序号(id)" + required: false + type: "integer" + format: "int32" + x-exportParamName: "MilestoneNumber" + x-optionalDataType: "Int32" + labels: + description: "用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance" + required: false + type: "string" + x-exportParamName: "Labels" + x-optionalDataType: "String" + issue: + description: "可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充" + required: false + type: "string" + x-exportParamName: "Issue" + x-optionalDataType: "String" + assignees: + description: "可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2)" + required: false + type: "string" + x-exportParamName: "Assignees" + x-optionalDataType: "String" + testers: + description: "可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2)" + required: false + type: "string" + x-exportParamName: "Testers" + x-optionalDataType: "String" + prune_source_branch: + description: "可选。合并PR后是否删除源分支,默认false(不删除)" + required: false + type: "boolean" + x-exportParamName: "PruneSourceBranch" + x-optionalDataType: "Bool" + PullRequest: type: "object" properties: diff --git a/docs/CreatePullRequestParam.md b/docs/CreatePullRequestParam.md new file mode 100644 index 0000000000000000000000000000000000000000..b5bf237ebd35b420e1c620a30646ed0938cf4785 --- /dev/null +++ b/docs/CreatePullRequestParam.md @@ -0,0 +1,20 @@ +# CreatePullRequestParam + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessToken** | **string** | 用户授权码 | [optional] [default to null] +**Title** | **string** | 必填。Pull Request 标题 | [optional] [default to null] +**Head** | **string** | 必填。Pull Request 提交的源分支。格式:branch 或者:username:branch | [optional] [default to null] +**Base** | **string** | 必填。Pull Request 提交目标分支的名称 | [optional] [default to null] +**Body** | **string** | 可选。Pull Request 内容 | [optional] [default to null] +**MilestoneNumber** | **int32** | 可选。里程碑序号(id) | [optional] [default to null] +**Labels** | **string** | 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | [optional] [default to null] +**Issue** | **string** | 可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充 | [optional] [default to null] +**Assignees** | **string** | 可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2) | [optional] [default to null] +**Testers** | **string** | 可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2) | [optional] [default to null] +**PruneSourceBranch** | **bool** | 可选。合并PR后是否删除源分支,默认false(不删除) | [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 9e5088e168c07797b56c5cc4c807303a5e2a705f..5ad92315dc1770bd6d8a01e39bac2009b96de0dd 100644 --- a/docs/PullRequestsApi.md +++ b/docs/PullRequestsApi.md @@ -609,7 +609,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) # **PostV5ReposOwnerRepoPulls** -> PullRequest PostV5ReposOwnerRepoPulls(ctx, owner, repo, title, head, base, optional) +> PullRequest PostV5ReposOwnerRepoPulls(ctx, owner, repo, body) 创建Pull Request 创建Pull Request @@ -621,29 +621,7 @@ Name | Type | Description | Notes **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **owner** | **string**| 仓库所属空间地址(企业、组织或个人的地址path) | **repo** | **string**| 仓库路径(path) | - **title** | **string**| 必填。Pull Request 标题 | - **head** | **string**| 必填。Pull Request 提交的源分支。格式:branch 或者:username:branch | - **base** | **string**| 必填。Pull Request 提交目标分支的名称 | - **optional** | ***PostV5ReposOwnerRepoPullsOpts** | optional parameters | nil if no parameters - -### Optional Parameters -Optional parameters are passed through a pointer to a PostV5ReposOwnerRepoPullsOpts struct - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - - - - - **accessToken** | **optional.String**| 用户授权码 | - **body** | **optional.String**| 可选。Pull Request 内容 | - **milestoneNumber** | **optional.Int32**| 可选。里程碑序号(id) | - **labels** | **optional.String**| 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | - **issue** | **optional.String**| 可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充 | - **assignees** | **optional.String**| 可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2) | - **testers** | **optional.String**| 可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2) | - **pruneSourceBranch** | **optional.Bool**| 可选。合并PR后是否删除源分支,默认false(不删除) | + **body** | [**CreatePullRequestParam**](CreatePullRequestParam.md)| pr的信息 | ### Return type diff --git a/gitee/api_pull_requests.go b/gitee/api_pull_requests.go index 8eb1c324189f17ff9a1a9501fb30b5ddb2081504..c19b71b8b1037822ea6d183e1d4e687f82d087a1 100644 --- a/gitee/api_pull_requests.go +++ b/gitee/api_pull_requests.go @@ -1514,34 +1514,11 @@ PullRequestsApiService 创建Pull Request * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param owner 仓库所属空间地址(企业、组织或个人的地址path) * @param repo 仓库路径(path) - * @param title 必填。Pull Request 标题 - * @param head 必填。Pull Request 提交的源分支。格式:branch 或者:username:branch - * @param base 必填。Pull Request 提交目标分支的名称 - * @param optional nil or *PostV5ReposOwnerRepoPullsOpts - Optional Parameters: - * @param "AccessToken" (optional.String) - 用户授权码 - * @param "Body" (optional.String) - 可选。Pull Request 内容 - * @param "MilestoneNumber" (optional.Int32) - 可选。里程碑序号(id) - * @param "Labels" (optional.String) - 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance - * @param "Issue" (optional.String) - 可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充 - * @param "Assignees" (optional.String) - 可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2) - * @param "Testers" (optional.String) - 可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2) - * @param "PruneSourceBranch" (optional.Bool) - 可选。合并PR后是否删除源分支,默认false(不删除) + * @param body pr的信息 @return PullRequest */ - -type PostV5ReposOwnerRepoPullsOpts struct { - AccessToken optional.String - Body optional.String - MilestoneNumber optional.Int32 - Labels optional.String - Issue optional.String - Assignees optional.String - Testers optional.String - PruneSourceBranch optional.Bool -} - -func (a *PullRequestsApiService) PostV5ReposOwnerRepoPulls(ctx context.Context, owner string, repo string, title string, head string, base string, localVarOptionals *PostV5ReposOwnerRepoPullsOpts) (PullRequest, *http.Response, error) { +func (a *PullRequestsApiService) PostV5ReposOwnerRepoPulls(ctx context.Context, owner string, repo string, body CreatePullRequestParam) (PullRequest, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} @@ -1576,33 +1553,8 @@ func (a *PullRequestsApiService) PostV5ReposOwnerRepoPulls(ctx context.Context, if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() { - localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), "")) - } - localVarFormParams.Add("title", parameterToString(title, "")) - localVarFormParams.Add("head", parameterToString(head, "")) - localVarFormParams.Add("base", parameterToString(base, "")) - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarFormParams.Add("body", parameterToString(localVarOptionals.Body.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.MilestoneNumber.IsSet() { - localVarFormParams.Add("milestone_number", parameterToString(localVarOptionals.MilestoneNumber.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Labels.IsSet() { - localVarFormParams.Add("labels", parameterToString(localVarOptionals.Labels.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Issue.IsSet() { - localVarFormParams.Add("issue", parameterToString(localVarOptionals.Issue.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Assignees.IsSet() { - localVarFormParams.Add("assignees", parameterToString(localVarOptionals.Assignees.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Testers.IsSet() { - localVarFormParams.Add("testers", parameterToString(localVarOptionals.Testers.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.PruneSourceBranch.IsSet() { - localVarFormParams.Add("prune_source_branch", parameterToString(localVarOptionals.PruneSourceBranch.Value(), "")) - } + // body params + localVarPostBody = &body r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err diff --git a/gitee/model_create_pull_request_param.go b/gitee/model_create_pull_request_param.go new file mode 100644 index 0000000000000000000000000000000000000000..a87c795b45de1662d9d337df14ffc053a53bf4ca --- /dev/null +++ b/gitee/model_create_pull_request_param.go @@ -0,0 +1,35 @@ +/* + * 码云 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 + +type CreatePullRequestParam struct { + // 用户授权码 + AccessToken string `json:"access_token,omitempty"` + // 必填。Pull Request 标题 + Title string `json:"title,omitempty"` + // 必填。Pull Request 提交的源分支。格式:branch 或者:username:branch + Head string `json:"head,omitempty"` + // 必填。Pull Request 提交目标分支的名称 + Base string `json:"base,omitempty"` + // 可选。Pull Request 内容 + Body string `json:"body,omitempty"` + // 可选。里程碑序号(id) + MilestoneNumber int32 `json:"milestone_number,omitempty"` + // 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance + Labels string `json:"labels,omitempty"` + // 可选。Pull Request的标题和内容可以根据指定的Issue Id自动填充 + Issue string `json:"issue,omitempty"` + // 可选。审查人员username,可多个,半角逗号分隔,如:(username1,username2) + Assignees string `json:"assignees,omitempty"` + // 可选。测试人员username,可多个,半角逗号分隔,如:(username1,username2) + Testers string `json:"testers,omitempty"` + // 可选。合并PR后是否删除源分支,默认false(不删除) + PruneSourceBranch bool `json:"prune_source_branch,omitempty"` +}