From 49b8d5a40fea9265707f5ed54036c74d56385327 Mon Sep 17 00:00:00 2001 From: edisonxiang Date: Sun, 29 Sep 2019 14:22:33 +0800 Subject: [PATCH] replace formdata with body --- README.md | 1 + api/swagger.yaml | 94 +++++++++++++----------- docs/PullRequestUpdateParam.md | 15 ++++ docs/PullRequestsApi.md | 19 +---- gitee/api_pull_requests.go | 43 ++--------- gitee/model_pull_request_update_param.go | 26 +++++++ 6 files changed, 99 insertions(+), 99 deletions(-) create mode 100644 docs/PullRequestUpdateParam.md create mode 100644 gitee/model_pull_request_update_param.go diff --git a/README.md b/README.md index 0eed5bd..ab5f7d5 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,7 @@ Class | Method | HTTP request | Description - [PullRequestComments](docs/PullRequestComments.md) - [PullRequestCommits](docs/PullRequestCommits.md) - [PullRequestFiles](docs/PullRequestFiles.md) + - [PullRequestUpdateParam](docs/PullRequestUpdateParam.md) - [Release](docs/Release.md) - [RepoCommit](docs/RepoCommit.md) - [SshKey](docs/SshKey.md) diff --git a/api/swagger.yaml b/api/swagger.yaml index 5c9e58b..a66e54a 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -4200,13 +4200,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)" @@ -4226,45 +4219,13 @@ paths: type: "integer" format: "int32" x-exportParamName: "Number" - - name: "title" - in: "formData" - description: "可选。Pull Request 标题" - required: false - type: "string" - x-exportParamName: "Title" - x-optionalDataType: "String" - - name: "body" - in: "formData" + - in: "body" + name: "body" description: "可选。Pull Request 内容" - required: false - type: "string" + required: true + schema: + $ref: "#/definitions/PullRequestUpdateParam" x-exportParamName: "Body" - x-optionalDataType: "String" - - name: "state" - in: "formData" - description: "可选。Pull Request 状态" - required: false - type: "string" - enum: - - "open" - - "closed" - x-exportParamName: "State" - 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" responses: 200: description: "返回格式" @@ -15968,3 +15929,48 @@ definitions: repo: $ref: "#/definitions/Project" description: "basic information" + PullRequestUpdateParam: + type: "object" + properties: + access_token: + type: "string" + description: "用户授权码" + x-exportParamName: "AccessToken" + x-optionalDataType: "String" + title: + type: "string" + description: "可选。Pull Request 标题" + x-exportParamName: "Title" + x-optionalDataType: "String" + body: + type: "string" + description: "可选。Pull Request 内容" + x-exportParamName: "Body" + x-optionalDataType: "String" + state: + type: "string" + description: "可选。Pull Request 状态" + enum: + - "open" + - "closed" + x-exportParamName: "State" + x-optionalDataType: "String" + milestone_number: + type: "integer" + format: "int32" + description: "可选。里程碑序号(id)" + x-exportParamName: "MilestoneNumber" + x-optionalDataType: "Int32" + labels: + type: "string" + description: "用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance" + x-exportParamName: "Labels" + x-optionalDataType: "String" + description: "update pull request information" + example: + access_token: "access_token" + milestone_number: 0 + state: "open" + title: "title" + body: "body" + labels: "labels" diff --git a/docs/PullRequestUpdateParam.md b/docs/PullRequestUpdateParam.md new file mode 100644 index 0000000..a3e58de --- /dev/null +++ b/docs/PullRequestUpdateParam.md @@ -0,0 +1,15 @@ +# PullRequestUpdateParam + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessToken** | **string** | 用户授权码 | [optional] [default to null] +**Title** | **string** | 可选。Pull Request 标题 | [optional] [default to null] +**Body** | **string** | 可选。Pull Request 内容 | [optional] [default to null] +**State** | **string** | 可选。Pull Request 状态 | [optional] [default to null] +**MilestoneNumber** | **int32** | 可选。里程碑序号(id) | [optional] [default to null] +**Labels** | **string** | 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | [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 4477607..fc64923 100644 --- a/docs/PullRequestsApi.md +++ b/docs/PullRequestsApi.md @@ -578,7 +578,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) # **PatchV5ReposOwnerRepoPullsNumber** -> PullRequest PatchV5ReposOwnerRepoPullsNumber(ctx, owner, repo, number, optional) +> PullRequest PatchV5ReposOwnerRepoPullsNumber(ctx, owner, repo, number, body) 更新Pull Request信息 更新Pull Request信息 @@ -591,22 +591,7 @@ Name | Type | Description | Notes **owner** | **string**| 仓库所属空间地址(企业、组织或个人的地址path) | **repo** | **string**| 仓库路径(path) | **number** | **int32**| 第几个PR,即本仓库PR的序数 | - **optional** | ***PatchV5ReposOwnerRepoPullsNumberOpts** | optional parameters | nil if no parameters - -### Optional Parameters -Optional parameters are passed through a pointer to a PatchV5ReposOwnerRepoPullsNumberOpts struct - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - - - **accessToken** | **optional.String**| 用户授权码 | - **title** | **optional.String**| 可选。Pull Request 标题 | - **body** | **optional.String**| 可选。Pull Request 内容 | - **state** | **optional.String**| 可选。Pull Request 状态 | - **milestoneNumber** | **optional.Int32**| 可选。里程碑序号(id) | - **labels** | **optional.String**| 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | + **body** | [**PullRequestUpdateParam**](PullRequestUpdateParam.md)| 可选。Pull Request 内容 | ### Return type diff --git a/gitee/api_pull_requests.go b/gitee/api_pull_requests.go index 07979f6..f98e1a3 100644 --- a/gitee/api_pull_requests.go +++ b/gitee/api_pull_requests.go @@ -12,12 +12,11 @@ package gitee import ( "context" "fmt" + "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" "strings" - - "github.com/antihax/optional" ) // Linger please @@ -1420,27 +1419,11 @@ PullRequestsApiService 更新Pull Request信息 * @param owner 仓库所属空间地址(企业、组织或个人的地址path) * @param repo 仓库路径(path) * @param number 第几个PR,即本仓库PR的序数 - * @param optional nil or *PatchV5ReposOwnerRepoPullsNumberOpts - Optional Parameters: - * @param "AccessToken" (optional.String) - 用户授权码 - * @param "Title" (optional.String) - 可选。Pull Request 标题 - * @param "Body" (optional.String) - 可选。Pull Request 内容 - * @param "State" (optional.String) - 可选。Pull Request 状态 - * @param "MilestoneNumber" (optional.Int32) - 可选。里程碑序号(id) - * @param "Labels" (optional.String) - 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance + * @param body 可选。Pull Request 内容 @return PullRequest */ - -type PatchV5ReposOwnerRepoPullsNumberOpts struct { - AccessToken optional.String - Title optional.String - Body optional.String - State optional.String - MilestoneNumber optional.Int32 - Labels optional.String -} - -func (a *PullRequestsApiService) PatchV5ReposOwnerRepoPullsNumber(ctx context.Context, owner string, repo string, number int32, localVarOptionals *PatchV5ReposOwnerRepoPullsNumberOpts) (PullRequest, *http.Response, error) { +func (a *PullRequestsApiService) PatchV5ReposOwnerRepoPullsNumber(ctx context.Context, owner string, repo string, number int32, body PullRequestUpdateParam) (PullRequest, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} @@ -1476,24 +1459,8 @@ func (a *PullRequestsApiService) PatchV5ReposOwnerRepoPullsNumber(ctx context.Co if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } - if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() { - localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Title.IsSet() { - localVarFormParams.Add("title", parameterToString(localVarOptionals.Title.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.Body.IsSet() { - localVarFormParams.Add("body", parameterToString(localVarOptionals.Body.Value(), "")) - } - if localVarOptionals != nil && localVarOptionals.State.IsSet() { - localVarFormParams.Add("state", parameterToString(localVarOptionals.State.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(), "")) - } + // 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_pull_request_update_param.go b/gitee/model_pull_request_update_param.go new file mode 100644 index 0000000..c6e06e3 --- /dev/null +++ b/gitee/model_pull_request_update_param.go @@ -0,0 +1,26 @@ +/* + * 码云 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 + +// update pull request information +type PullRequestUpdateParam struct { + // 用户授权码 + AccessToken string `json:"access_token,omitempty"` + // 可选。Pull Request 标题 + Title string `json:"title,omitempty"` + // 可选。Pull Request 内容 + Body string `json:"body,omitempty"` + // 可选。Pull Request 状态 + State string `json:"state,omitempty"` + // 可选。里程碑序号(id) + MilestoneNumber int32 `json:"milestone_number,omitempty"` + // 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance + Labels string `json:"labels,omitempty"` +} -- GitLab