mirror of
https://gitea.com/gitea/tea
synced 2024-11-02 15:40:21 +00:00
[Vendor] Update gitea go-sdk to 2020-01-03 (#81)
update sdk to v0.0.0-20200103062250-c7686bd633c6 Co-authored-by: 6543 <6543@obermui.de> Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: sapk <sapk@noreply.gitea.io> Reviewed-by: mrsdizzie <info@mrsdizzie.com>
This commit is contained in:
parent
6e85b47f7c
commit
3c66a7af24
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module code.gitea.io/tea
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
code.gitea.io/sdk/gitea v0.0.0-20191013013401-e41e9ea72caa
|
||||
code.gitea.io/sdk/gitea v0.0.0-20200103062250-c7686bd633c6
|
||||
github.com/go-gitea/yaml v0.0.0-20170812160011-eb3733d160e7
|
||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.1
|
||||
|
4
go.sum
4
go.sum
@ -1,5 +1,5 @@
|
||||
code.gitea.io/sdk/gitea v0.0.0-20191013013401-e41e9ea72caa h1:KgpwNF1StxPXMfCD9M++jvCUPUqHPAbuvQn1q3sWtqw=
|
||||
code.gitea.io/sdk/gitea v0.0.0-20191013013401-e41e9ea72caa/go.mod h1:8IxkM1gyiwEjfO0m47bcmr3u3foR15+LoVub43hCHd0=
|
||||
code.gitea.io/sdk/gitea v0.0.0-20200103062250-c7686bd633c6 h1:SFCUXiw/mg8Luu6+2/X8g4a0NGaT8eClU/bWjCKjs3o=
|
||||
code.gitea.io/sdk/gitea v0.0.0-20200103062250-c7686bd633c6/go.mod h1:8IxkM1gyiwEjfO0m47bcmr3u3foR15+LoVub43hCHd0=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
|
3
vendor/code.gitea.io/sdk/gitea/client.go
generated
vendored
3
vendor/code.gitea.io/sdk/gitea/client.go
generated
vendored
@ -39,9 +39,10 @@ func NewClient(url, token string) *Client {
|
||||
}
|
||||
|
||||
// NewClientWithHTTP creates an API client with a custom http client
|
||||
func NewClientWithHTTP(url string, httpClient *http.Client) {
|
||||
func NewClientWithHTTP(url string, httpClient *http.Client) *Client {
|
||||
client := NewClient(url, "")
|
||||
client.client = httpClient
|
||||
return client
|
||||
}
|
||||
|
||||
// SetHTTPClient replaces default http.Client with user given one.
|
||||
|
16
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
generated
vendored
16
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
generated
vendored
@ -16,9 +16,13 @@ type TrackedTime struct {
|
||||
ID int64 `json:"id"`
|
||||
Created time.Time `json:"created"`
|
||||
// Time in seconds
|
||||
Time int64 `json:"time"`
|
||||
UserID int64 `json:"user_id"`
|
||||
IssueID int64 `json:"issue_id"`
|
||||
Time int64 `json:"time"`
|
||||
// deprecated (only for backwards compatibility)
|
||||
UserID int64 `json:"user_id"`
|
||||
UserName string `json:"user_name"`
|
||||
// deprecated (only for backwards compatibility)
|
||||
IssueID int64 `json:"issue_id"`
|
||||
Issue *Issue `json:"issue"`
|
||||
}
|
||||
|
||||
// GetUserTrackedTimes list tracked times of a user
|
||||
@ -42,7 +46,11 @@ func (c *Client) GetMyTrackedTimes() ([]*TrackedTime, error) {
|
||||
// AddTimeOption options for adding time to an issue
|
||||
type AddTimeOption struct {
|
||||
// time in seconds
|
||||
Time int64 `json:"time"`
|
||||
Time int64 `json:"time" binding:"Required"`
|
||||
// optional
|
||||
Created time.Time `json:"created"`
|
||||
// optional
|
||||
User string `json:"user_name"`
|
||||
}
|
||||
|
||||
// AddTime adds time to issue with the given index
|
||||
|
2
vendor/code.gitea.io/sdk/gitea/miscellaneous.go
generated
vendored
2
vendor/code.gitea.io/sdk/gitea/miscellaneous.go
generated
vendored
@ -9,5 +9,5 @@ func (c *Client) ServerVersion() (string, error) {
|
||||
var v = struct {
|
||||
Version string `json:"version"`
|
||||
}{}
|
||||
return v.Version, c.getParsedResponse("GET", "/api/v1/version", nil, nil, &v)
|
||||
return v.Version, c.getParsedResponse("GET", "/version", nil, nil, &v)
|
||||
}
|
||||
|
25
vendor/code.gitea.io/sdk/gitea/pull.go
generated
vendored
25
vendor/code.gitea.io/sdk/gitea/pull.go
generated
vendored
@ -1,4 +1,5 @@
|
||||
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
@ -124,10 +125,28 @@ func (c *Client) EditPullRequest(owner, repo string, index int64, opt EditPullRe
|
||||
jsonHeader, bytes.NewReader(body), pr)
|
||||
}
|
||||
|
||||
// MergePullRequestOption options when merging a pull request
|
||||
type MergePullRequestOption struct {
|
||||
// required: true
|
||||
// enum: merge,rebase,rebase-merge,squash
|
||||
Do string `json:"Do" binding:"Required;In(merge,rebase,rebase-merge,squash)"`
|
||||
MergeTitleField string `json:"MergeTitleField"`
|
||||
MergeMessageField string `json:"MergeMessageField"`
|
||||
}
|
||||
|
||||
// MergePullRequestResponse response when merging a pull request
|
||||
type MergePullRequestResponse struct {
|
||||
}
|
||||
|
||||
// MergePullRequest merge a PR to repository by PR id
|
||||
func (c *Client) MergePullRequest(owner, repo string, index int64) error {
|
||||
_, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/pulls/%d/merge", owner, repo, index), nil, nil)
|
||||
return err
|
||||
func (c *Client) MergePullRequest(owner, repo string, index int64, opt MergePullRequestOption) (*MergePullRequestResponse, error) {
|
||||
body, err := json.Marshal(&opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response := new(MergePullRequestResponse)
|
||||
return response, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/pulls/%d/merge", owner, repo, index),
|
||||
jsonHeader, bytes.NewReader(body), response)
|
||||
}
|
||||
|
||||
// IsPullRequestMerged test if one PR is merged to one repository
|
||||
|
45
vendor/code.gitea.io/sdk/gitea/repo_topics.go
generated
vendored
Normal file
45
vendor/code.gitea.io/sdk/gitea/repo_topics.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package gitea
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// TopicsList represents a list of repo's topics
|
||||
type TopicsList struct {
|
||||
Topics []string `json:"topics"`
|
||||
}
|
||||
|
||||
// ListRepoTopics list all repository's topics
|
||||
func (c *Client) ListRepoTopics(user, repo string) (*TopicsList, error) {
|
||||
var list TopicsList
|
||||
return &list, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/topics", user, repo), nil, nil, &list)
|
||||
}
|
||||
|
||||
// SetRepoTopics replaces the list of repo's topics
|
||||
func (c *Client) SetRepoTopics(user, repo, list TopicsList) error {
|
||||
body, err := json.Marshal(&list)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = c.getResponse("PUT", fmt.Sprintf("/repos/%s/%s/topics", user, repo), nil, bytes.NewReader(body))
|
||||
return err
|
||||
}
|
||||
|
||||
// AddRepoTopic adds a topic to a repo's topics list
|
||||
func (c *Client) AddRepoTopic(user, repo, topic string) error {
|
||||
_, err := c.getResponse("PUT", fmt.Sprintf("/repos/%s/%s/topics/%s", user, repo, topic), nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteRepoTopic deletes a topic from repo's topics list
|
||||
func (c *Client) DeleteRepoTopic(user, repo, topic string) error {
|
||||
_, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s/topics/%s", user, repo, topic), nil, nil)
|
||||
return err
|
||||
}
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1,4 +1,4 @@
|
||||
# code.gitea.io/sdk/gitea v0.0.0-20191013013401-e41e9ea72caa
|
||||
# code.gitea.io/sdk/gitea v0.0.0-20200103062250-c7686bd633c6
|
||||
code.gitea.io/sdk/gitea
|
||||
# github.com/davecgh/go-spew v1.1.1
|
||||
github.com/davecgh/go-spew/spew
|
||||
|
Loading…
Reference in New Issue
Block a user