From cb11a92518a26685cd12738ee198c03f8e304e7e Mon Sep 17 00:00:00 2001 From: chenyanpanHW Date: Mon, 28 Dec 2020 22:38:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"!32=20GetV5ReposOwnerRepoPullsNum?= =?UTF-8?q?berCommits=20=E6=9C=AA=E6=AD=A3=E7=A1=AE=E5=8F=8D=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=20=20PullRequestCommits=20=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E6=88=90=E5=91=98=E9=97=AE=E9=A2=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 02b1f8ea9e668048e76b7b081d37f4ce11569cd6, reversing changes made to c4384bf8d3330cf5f9081dcc9bc08c8ffe93a9c0. --- gitee/model_pull_request_commits.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gitee/model_pull_request_commits.go b/gitee/model_pull_request_commits.go index d83684c..ef82c64 100644 --- a/gitee/model_pull_request_commits.go +++ b/gitee/model_pull_request_commits.go @@ -11,12 +11,12 @@ package gitee // 获取某Pull Request的所有Commit信息。最多显示250条Commit type PullRequestCommits struct { - Url string `json:"url,omitempty"` - Sha string `json:"sha,omitempty"` - HtmlUrl string `json:"html_url,omitempty"` - CommentsUrl string `json:"comments_url,omitempty"` - Commit Commit `json:"commit,omitempty"` - Author UserBasic `json:"author,omitempty"` - Committer UserBasic `json:"committer,omitempty"` - Parents CommitTree `json:"parents,omitempty"` + Url string `json:"url,omitempty"` + Sha string `json:"sha,omitempty"` + HtmlUrl string `json:"html_url,omitempty"` + CommentsUrl string `json:"comments_url,omitempty"` + Commit string `json:"commit,omitempty"` + Author string `json:"author,omitempty"` + Committer string `json:"committer,omitempty"` + Parents string `json:"parents,omitempty"` } -- Gitee From b4f7e83697870ee082ed397f6acbf924bf5dcc21 Mon Sep 17 00:00:00 2001 From: chenyanpanHW Date: Mon, 28 Dec 2020 23:19:44 +0800 Subject: [PATCH 2/2] add GitUser and GitCommit to unmarshal PullRequestCommits correctly --- api/swagger.yaml | 32 +++++++++++++++++++++++---- gitee/api_emails.go | 3 ++- gitee/api_issues.go | 3 ++- gitee/api_pull_requests.go | 3 ++- gitee/api_repositories.go | 8 +++---- gitee/model_complete_branch.go | 10 ++++----- gitee/model_git_commit.go | 18 +++++++++++++++ gitee/model_git_user.go | 20 +++++++++++++++++ gitee/model_pull_request_commits.go | 16 +++++++------- gitee/model_pull_request_file_path.go | 18 +++++++-------- gitee/model_pull_request_files.go | 16 +++++++------- 11 files changed, 105 insertions(+), 42 deletions(-) create mode 100644 gitee/model_git_commit.go create mode 100644 gitee/model_git_user.go diff --git a/api/swagger.yaml b/api/swagger.yaml index ad9a52f..3bf3a78 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -14530,6 +14530,30 @@ definitions: position: "position" commit_id: "commit_id" user: "user" + GitUser: + type: "object" + properties: + name: + type: "string" + email: + type: "string" + date: + type: "string" + format: "date-time" + GitCommit: + type: "object" + properties: + url: + type: "string" + author: + $ref: "#/definitions/GitUser" + committer: + $ref: "#/definitions/GitUser" + message: + type: "string" + comment_count: + type: integer + format: int32 PullRequestCommits: type: "object" properties: @@ -14542,13 +14566,13 @@ definitions: comments_url: type: "string" commit: - type: "string" + $ref: "#/definitions/GitCommit" author: - type: "string" + $ref: "#/definitions/UserBasic" committer: - type: "string" + $ref: "#/definitions/UserBasic" parents: - type: "string" + $ref: "#/definitions/CommitTree" description: "获取某Pull Request的所有Commit信息。最多显示250条Commit" example: committer: "committer" diff --git a/gitee/api_emails.go b/gitee/api_emails.go index 57500fb..40878e1 100644 --- a/gitee/api_emails.go +++ b/gitee/api_emails.go @@ -11,11 +11,12 @@ package gitee import ( "context" - "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" "strings" + + "github.com/antihax/optional" ) // Linger please diff --git a/gitee/api_issues.go b/gitee/api_issues.go index ddf7b4d..71be47f 100644 --- a/gitee/api_issues.go +++ b/gitee/api_issues.go @@ -12,11 +12,12 @@ package gitee import ( "context" "fmt" - "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" "strings" + + "github.com/antihax/optional" ) // Linger please diff --git a/gitee/api_pull_requests.go b/gitee/api_pull_requests.go index 30fedb8..166ffc1 100644 --- a/gitee/api_pull_requests.go +++ b/gitee/api_pull_requests.go @@ -12,11 +12,12 @@ package gitee import ( "context" "fmt" - "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" "strings" + + "github.com/antihax/optional" ) // Linger please diff --git a/gitee/api_repositories.go b/gitee/api_repositories.go index aaad8fc..26ed367 100644 --- a/gitee/api_repositories.go +++ b/gitee/api_repositories.go @@ -12,11 +12,12 @@ package gitee import ( "context" "fmt" - "github.com/antihax/optional" "io/ioutil" "net/http" "net/url" "strings" + + "github.com/antihax/optional" ) // Linger please @@ -5772,7 +5773,6 @@ func (a *RepositoriesApiService) PutV5ReposOwnerRepoReviewer(ctx context.Context localVarPostBody interface{} localVarFileName string localVarFileBytes []byte - ) // create path and map variables @@ -5819,10 +5819,9 @@ func (a *RepositoriesApiService) PutV5ReposOwnerRepoReviewer(ctx context.Context return localVarHttpResponse, err } - if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } @@ -5831,4 +5830,3 @@ func (a *RepositoriesApiService) PutV5ReposOwnerRepoReviewer(ctx context.Context return localVarHttpResponse, nil } - diff --git a/gitee/model_complete_branch.go b/gitee/model_complete_branch.go index bbe31f0..30b111c 100644 --- a/gitee/model_complete_branch.go +++ b/gitee/model_complete_branch.go @@ -11,9 +11,9 @@ package gitee // 创建分支 type CompleteBranch struct { - Name string `json:"name,omitempty"` - Commit *BranchCommit `json:"commit,omitempty"` - Links string `json:"_links,omitempty"` - Protected string `json:"protected,omitempty"` - ProtectionUrl string `json:"protection_url,omitempty"` + Name string `json:"name,omitempty"` + Commit *BranchCommit `json:"commit,omitempty"` + Links string `json:"_links,omitempty"` + Protected string `json:"protected,omitempty"` + ProtectionUrl string `json:"protection_url,omitempty"` } diff --git a/gitee/model_git_commit.go b/gitee/model_git_commit.go new file mode 100644 index 0000000..7da5de2 --- /dev/null +++ b/gitee/model_git_commit.go @@ -0,0 +1,18 @@ +/* + * 码云 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 GitCommit struct { + Url string `json:"url,omitempty"` + Author *GitUser `json:"author,omitempty"` + Committer *GitUser `json:"committer,omitempty"` + Message string `json:"message,omitempty"` + CommentCount int32 `json:"comment_count,omitempty"` +} diff --git a/gitee/model_git_user.go b/gitee/model_git_user.go new file mode 100644 index 0000000..6e7d2f5 --- /dev/null +++ b/gitee/model_git_user.go @@ -0,0 +1,20 @@ +/* + * 码云 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 + +import ( + "time" +) + +type GitUser struct { + Name string `json:"name,omitempty"` + Email string `json:"email,omitempty"` + Date time.Time `json:"date,omitempty"` +} diff --git a/gitee/model_pull_request_commits.go b/gitee/model_pull_request_commits.go index ef82c64..891f083 100644 --- a/gitee/model_pull_request_commits.go +++ b/gitee/model_pull_request_commits.go @@ -11,12 +11,12 @@ package gitee // 获取某Pull Request的所有Commit信息。最多显示250条Commit type PullRequestCommits struct { - Url string `json:"url,omitempty"` - Sha string `json:"sha,omitempty"` - HtmlUrl string `json:"html_url,omitempty"` - CommentsUrl string `json:"comments_url,omitempty"` - Commit string `json:"commit,omitempty"` - Author string `json:"author,omitempty"` - Committer string `json:"committer,omitempty"` - Parents string `json:"parents,omitempty"` + Url string `json:"url,omitempty"` + Sha string `json:"sha,omitempty"` + HtmlUrl string `json:"html_url,omitempty"` + CommentsUrl string `json:"comments_url,omitempty"` + Commit *GitCommit `json:"commit,omitempty"` + Author *UserBasic `json:"author,omitempty"` + Committer *UserBasic `json:"committer,omitempty"` + Parents *CommitTree `json:"parents,omitempty"` } diff --git a/gitee/model_pull_request_file_path.go b/gitee/model_pull_request_file_path.go index 33b6926..05d554e 100644 --- a/gitee/model_pull_request_file_path.go +++ b/gitee/model_pull_request_file_path.go @@ -11,13 +11,13 @@ package gitee // 单个文件的patch信息 type PullRequestFilePath struct { - Diff string `json:"diff,omitempty"` - NewPath string `json:"new_path,omitempty"` - OldPath string `json:"old_path,omitempty"` - AMode string `json:"a_mode,omitempty"` - BMode string `json:"b_mode,omitempty"` - NewFile bool `json:"new_file,omitempty"` - RenamedFile bool `json:"renamed_file,omitempty"` - DeletedFile bool `json:"deleted_file,omitempty"` - TooLarge bool `json:"too_large,omitempty"` + Diff string `json:"diff,omitempty"` + NewPath string `json:"new_path,omitempty"` + OldPath string `json:"old_path,omitempty"` + AMode string `json:"a_mode,omitempty"` + BMode string `json:"b_mode,omitempty"` + NewFile bool `json:"new_file,omitempty"` + RenamedFile bool `json:"renamed_file,omitempty"` + DeletedFile bool `json:"deleted_file,omitempty"` + TooLarge bool `json:"too_large,omitempty"` } diff --git a/gitee/model_pull_request_files.go b/gitee/model_pull_request_files.go index bff3c4e..03d2891 100644 --- a/gitee/model_pull_request_files.go +++ b/gitee/model_pull_request_files.go @@ -11,12 +11,12 @@ package gitee // Pull Request Commit文件列表。最多显示300条diff type PullRequestFiles struct { - Sha string `json:"sha,omitempty"` - Filename string `json:"filename,omitempty"` - Status string `json:"status,omitempty"` - Additions string `json:"additions,omitempty"` - Deletions string `json:"deletions,omitempty"` - BlobUrl string `json:"blob_url,omitempty"` - RawUrl string `json:"raw_url,omitempty"` - Patch *PullRequestFilePath `json:"patch,omitempty"` + Sha string `json:"sha,omitempty"` + Filename string `json:"filename,omitempty"` + Status string `json:"status,omitempty"` + Additions string `json:"additions,omitempty"` + Deletions string `json:"deletions,omitempty"` + BlobUrl string `json:"blob_url,omitempty"` + RawUrl string `json:"raw_url,omitempty"` + Patch *PullRequestFilePath `json:"patch,omitempty"` } -- Gitee