chore: update to latest sdk (no release yet!)
This commit is contained in:
parent
259af57371
commit
a2792f479f
2 changed files with 14 additions and 35 deletions
18
github.go
18
github.go
|
@ -43,10 +43,6 @@ func NewGitHub(client ApiClient) *GitHub {
|
|||
return &GitHub{client: client}
|
||||
}
|
||||
|
||||
// Determine whether the request `content-type` includes a
|
||||
// server-acceptable mime-type
|
||||
//
|
||||
// Failure should yield an HTTP 415 (`http.StatusUnsupportedMediaType`)
|
||||
func HasContentType(r *http.Response, mimetype string) bool {
|
||||
contentType := r.Header.Get("Content-type")
|
||||
if contentType == "" {
|
||||
|
@ -78,8 +74,8 @@ type GitTag struct {
|
|||
ZipballURL string `json:"zipball_url,omitempty"`
|
||||
}
|
||||
|
||||
func (gh *GitHub) GetGitTagInfo(owner, repo, tag string, ctx context.Context) (*GitTag, error) {
|
||||
url := fmt.Sprintf("/repos/%s/%s/tags/%s", owner, repo, tag)
|
||||
func (gh *GitHub) GetGitTagInfo(repository, tag string, ctx context.Context) (*GitTag, error) {
|
||||
url := fmt.Sprintf("/repos/%s/tags/%s", repository, tag)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -117,8 +113,7 @@ func (gh *GitHub) GetGitTagInfo(owner, repo, tag string, ctx context.Context) (*
|
|||
}
|
||||
|
||||
type CreateReleaseRequest struct {
|
||||
Owner string `json:"-"`
|
||||
Repo string `json:"-"`
|
||||
Repository string `json:"-"`
|
||||
|
||||
Body string `json:"body,omitempty"`
|
||||
Draft bool `json:"draft,omitempty"`
|
||||
|
@ -153,7 +148,7 @@ func (gh *GitHub) CreateRelease(creq *CreateReleaseRequest, ctx context.Context)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("/repos/%s/%s/releases", creq.Owner, creq.Repo)
|
||||
url := fmt.Sprintf("/repos/%s/releases", creq.Repository)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, &b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -206,8 +201,7 @@ func (gh *GitHub) CreateRelease(creq *CreateReleaseRequest, ctx context.Context)
|
|||
}
|
||||
|
||||
type CreateReleaseArtifactRequest struct {
|
||||
Owner string `json:"-"`
|
||||
Repo string `json:"-"`
|
||||
Repository string `json:"-"`
|
||||
|
||||
Id int64 `json:"-"`
|
||||
|
||||
|
@ -257,7 +251,7 @@ func (gh *GitHub) CreateReleaseArtifact(creq *CreateReleaseArtifactRequest, ctx
|
|||
|
||||
w.Close()
|
||||
|
||||
url := fmt.Sprintf("/repos/%s/%s/releases/%d/assets", creq.Owner, creq.Repo, creq.Id)
|
||||
url := fmt.Sprintf("/repos/%s/releases/%d/assets", creq.Repository, creq.Id)
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, &b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue