Skip to content

Commit

Permalink
fix create issue result 400 (#16)
Browse files Browse the repository at this point in the history
* fix create issue result 400

* run test and bazel build success

Co-authored-by: xwzQmxx <[email protected]>
  • Loading branch information
xwz123 and wizard-xie authored Mar 17, 2022
1 parent e844bcd commit 684a166
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 129 deletions.
130 changes: 69 additions & 61 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1399,75 +1399,19 @@ 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)"
required: true
type: "string"
x-exportParamName: "Owner"
- name: "repo"
in: "formData"
description: "仓库路径(path)"
required: false
type: "string"
x-exportParamName: "Repo"
x-optionalDataType: "String"
- name: "title"
in: "formData"
description: "Issue标题"
- in: "body"
name: "body"
description: "可选。Issue 内容"
required: true
type: "string"
x-exportParamName: "Title"
- name: "issue_type"
in: "formData"
description: "企业自定义任务类型,非企业默认任务类型为“任务”"
required: false
type: "string"
x-exportParamName: "IssueType"
x-optionalDataType: "String"
- name: "body"
in: "formData"
description: "Issue描述"
required: false
type: "string"
schema:
$ref: "#/definitions/IssueCreateParam"
x-exportParamName: "Body"
x-optionalDataType: "String"
- name: "assignee"
in: "formData"
description: "Issue负责人的username"
required: false
type: "string"
x-exportParamName: "Assignee"
x-optionalDataType: "String"
- name: "milestone"
in: "formData"
description: "里程碑序号"
required: false
type: "integer"
format: "int32"
x-exportParamName: "Milestone"
x-optionalDataType: "Int32"
- name: "labels"
in: "formData"
description: "用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance"
required: false
type: "string"
x-exportParamName: "Labels"
x-optionalDataType: "String"
- name: "program"
in: "formData"
description: "项目ID"
required: false
type: "string"
x-exportParamName: "Program"
x-optionalDataType: "String"
responses:
201:
description: "返回格式"
Expand Down Expand Up @@ -16045,6 +15989,70 @@ definitions:
title: "title"
body: "body"
labels: "labels"
IssueCreateParam:
type: "object"
properties:
access_token:
type: "string"
description: "用户授权码"
x-exportParamName: "AccessToken"
x-optionalDataType: "String"
repo:
type: "string"
description: "仓库路径(path)"
x-exportParamName: "Repo"
x-optionalDataType: "String"
title:
type: "string"
description: "Issue标题"
x-exportParamName: "Title"
x-optionalDataType: "String"
issu_type:
type: "string"
description: "企业自定义任务类型,非企业默认任务类型为“任务”"
x-exportParamName: "IssueType"
x-optionalDataType: "String"
body:
type: "string"
description: "Issue描述"
x-exportParamName: "Body"
x-optionalDataType: "String"
assignee:
type: "string"
description: "Issue负责人的username"
x-exportParamName: "Assignee"
x-optionalDataType: "String"
milestone:
type: "integer"
format: "int32"
description: "里程碑序号"
x-exportParamName: "Milestone"
x-optionalDataType: "Int32"
labels:
type: "string"
description: "用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance"
x-exportParamName: "Labels"
x-optionalDataType: "String"
program:
type: "string"
description: "项目ID"
x-exportParamName: "Program"
x-optionalDataType: "String"
collaborators:
type: "string"
description: "Issue协助者的个人空间地址, 以 , 分隔"
x-exportParamName: "Collaborators"
x-optionalDataType: "String"
description: "create issue information"
example:
access_token: "access_token"
milestone: 0
repo: "repo"
assignee: "assignee"
program: "program"
title: "title"
body: "body"
labels: "labels"
RepositoryPostParam:
type: "object"
properties:
Expand Down
19 changes: 19 additions & 0 deletions docs/IssueCreateParam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# IssueCreateParam

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**AccessToken** | **string** | 用户授权码 | [optional] [default to null]
**Repo** | **string** | 仓库路径(path) | [optional] [default to null]
**Title** | **string** | Issue标题 | [optional] [default to null]
**IssuType** | **string** | 企业自定义任务类型,非企业默认任务类型为“任务” | [optional] [default to null]
**Body** | **string** | Issue描述 | [optional] [default to null]
**Assignee** | **string** | Issue负责人的username | [optional] [default to null]
**Milestone** | **int32** | 里程碑序号 | [optional] [default to null]
**Labels** | **string** | 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance | [optional] [default to null]
**Program** | **string** | 项目ID | [optional] [default to null]
**Collaborators** | **string** | Issue协助者的个人空间地址, 以 , 分隔 | [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)


23 changes: 3 additions & 20 deletions docs/IssuesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ Name | Type | Description | Notes
**owner** | **string**| 仓库所属空间地址(企业、组织或个人的地址path) |
**repo** | **string**| 仓库路径(path) |
**id** | **int32**| 评论的ID |
**body** | [**IssueCommentPatchParam**](IssueCommentPatchParam.md)| 必填。评论内容 |
**body** | [**IssueCommentPatchParam**](IssueCommentPatchParam.md)| 必填。评论内容 |

### Return type

Expand All @@ -708,7 +708,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)

# **PostV5ReposOwnerIssues**
> Issue PostV5ReposOwnerIssues(ctx, owner, title, optional)
> Issue PostV5ReposOwnerIssues(ctx, owner, body)
创建Issue

创建Issue
Expand All @@ -719,24 +719,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**owner** | **string**| 仓库所属空间地址(企业、组织或个人的地址path) |
**title** | **string**| Issue标题 |
**optional** | ***PostV5ReposOwnerIssuesOpts** | optional parameters | nil if no parameters

### Optional Parameters
Optional parameters are passed through a pointer to a PostV5ReposOwnerIssuesOpts struct

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------


**accessToken** | **optional.String**| 用户授权码 |
**repo** | **optional.String**| 仓库路径(path) |
**issueType** | **optional.String**| 企业自定义任务类型,非企业默认任务类型为“任务” |
**body** | **optional.String**| Issue描述 |
**assignee** | **optional.String**| Issue负责人的username |
**milestone** | **optional.Int32**| 里程碑序号 |
**labels** | **optional.String**| 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance |
**program** | **optional.String**| 项目ID |
**body** | [**IssueCreateParam**](IssueCreateParam.md)| 可选。Issue 内容 |

### Return type

Expand Down
1 change: 1 addition & 0 deletions gitee/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ go_library(
"model_issue.go",
"model_issue_comment_patch_param.go",
"model_issue_comment_post_param.go",
"model_issue_create_param.go",
"model_issue_update_param.go",
"model_label.go",
"model_label_post_param.go",
Expand Down
52 changes: 4 additions & 48 deletions gitee/api_issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -2011,32 +2011,11 @@ IssuesApiService 创建Issue
创建Issue
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param title Issue标题
* @param optional nil or *PostV5ReposOwnerIssuesOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Repo" (optional.String) - 仓库路径(path)
* @param "IssueType" (optional.String) - 企业自定义任务类型,非企业默认任务类型为“任务”
* @param "Body" (optional.String) - Issue描述
* @param "Assignee" (optional.String) - Issue负责人的username
* @param "Milestone" (optional.Int32) - 里程碑序号
* @param "Labels" (optional.String) - 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance
* @param "Program" (optional.String) - 项目ID
* @param body 可选。Issue 内容
@return Issue
*/

type PostV5ReposOwnerIssuesOpts struct {
AccessToken optional.String
Repo optional.String
IssueType optional.String
Body optional.String
Assignee optional.String
Milestone optional.Int32
Labels optional.String
Program optional.String
}

func (a *IssuesApiService) PostV5ReposOwnerIssues(ctx context.Context, owner string, title string, localVarOptionals *PostV5ReposOwnerIssuesOpts) (Issue, *http.Response, error) {
func (a *IssuesApiService) PostV5ReposOwnerIssues(ctx context.Context, owner string, body IssueCreateParam) (Issue, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
Expand Down Expand Up @@ -2070,31 +2049,8 @@ func (a *IssuesApiService) PostV5ReposOwnerIssues(ctx context.Context, owner str
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Repo.IsSet() {
localVarFormParams.Add("repo", parameterToString(localVarOptionals.Repo.Value(), ""))
}
localVarFormParams.Add("title", parameterToString(title, ""))
if localVarOptionals != nil && localVarOptionals.IssueType.IsSet() {
localVarFormParams.Add("issue_type", parameterToString(localVarOptionals.IssueType.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
localVarFormParams.Add("body", parameterToString(localVarOptionals.Body.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Assignee.IsSet() {
localVarFormParams.Add("assignee", parameterToString(localVarOptionals.Assignee.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Milestone.IsSet() {
localVarFormParams.Add("milestone", parameterToString(localVarOptionals.Milestone.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Labels.IsSet() {
localVarFormParams.Add("labels", parameterToString(localVarOptionals.Labels.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Program.IsSet() {
localVarFormParams.Add("program", parameterToString(localVarOptionals.Program.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
Expand Down
34 changes: 34 additions & 0 deletions gitee/model_issue_create_param.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 码云 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

// create issue information
type IssueCreateParam struct {
// 用户授权码
AccessToken string `json:"access_token,omitempty"`
// 仓库路径(path)
Repo string `json:"repo,omitempty"`
// Issue标题
Title string `json:"title,omitempty"`
// 企业自定义任务类型,非企业默认任务类型为“任务”
IssuType string `json:"issu_type,omitempty"`
// Issue描述
Body string `json:"body,omitempty"`
// Issue负责人的username
Assignee string `json:"assignee,omitempty"`
// 里程碑序号
Milestone int32 `json:"milestone,omitempty"`
// 用逗号分开的标签,名称要求长度在 2-20 之间且非特殊字符。如: bug,performance
Labels string `json:"labels,omitempty"`
// 项目ID
Program string `json:"program,omitempty"`
// Issue协助者的个人空间地址, 以 , 分隔
Collaborators string `json:"collaborators,omitempty"`
}

0 comments on commit 684a166

Please sign in to comment.