chore: update to latest sdk (no release yet!)

This commit is contained in:
Louis Seubert 2024-11-01 23:58:56 +01:00
commit a2792f479f
Signed by: louis9902
GPG key ID: 4B9DB28F826553BD
2 changed files with 14 additions and 35 deletions

View file

@ -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