mirror of
https://gitea.com/gitea/tea
synced 2024-05-08 16:56:06 +02:00
0d98cbd657
* update & migrate gitea sdk (Fix Delete Tag Issue) * upgraded github.com/AlecAivazis/survey v2.2.7 => v2.2.8 * upgraded github.com/adrg/xdg v0.2.3 => v0.3.1 * upgraded github.com/araddon/dateparse * upgraded github.com/olekukonko/tablewriter v0.0.4 => v0.0.5 * upgraded gopkg.in/yaml.v2 v2.3.0 => v2.4.0 Reviewed-on: https://gitea.com/gitea/tea/pulls/337 Reviewed-by: Norwin <noerw@noreply.gitea.io> Reviewed-by: khmarbaise <khmarbaise@noreply.gitea.io> Co-authored-by: 6543 <6543@obermui.de> Co-committed-by: 6543 <6543@obermui.de>
43 lines
1.3 KiB
Go
43 lines
1.3 KiB
Go
// 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.
|
|
|
|
package gitea
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// Tag represents a repository tag
|
|
type Tag struct {
|
|
Name string `json:"name"`
|
|
ID string `json:"id"`
|
|
Commit *CommitMeta `json:"commit"`
|
|
ZipballURL string `json:"zipball_url"`
|
|
TarballURL string `json:"tarball_url"`
|
|
}
|
|
|
|
// ListRepoTagsOptions options for listing a repository's tags
|
|
type ListRepoTagsOptions struct {
|
|
ListOptions
|
|
}
|
|
|
|
// ListRepoTags list all the branches of one repository
|
|
func (c *Client) ListRepoTags(user, repo string, opt ListRepoTagsOptions) ([]*Tag, *Response, error) {
|
|
opt.setDefaults()
|
|
tags := make([]*Tag, 0, opt.PageSize)
|
|
resp, err := c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/tags?%s", user, repo, opt.getURLQuery().Encode()), nil, nil, &tags)
|
|
return tags, resp, err
|
|
}
|
|
|
|
// DeleteTag deletes a tag from a repository, if no release refers to it
|
|
func (c *Client) DeleteTag(user, repo string, tag string) (*Response, error) {
|
|
if err := c.checkServerVersionGreaterThanOrEqual(version1_14_0); err != nil {
|
|
return nil, err
|
|
}
|
|
_, resp, err := c.getResponse("DELETE",
|
|
fmt.Sprintf("/repos/%s/%s/tags/%s", user, repo, tag),
|
|
nil, nil)
|
|
return resp, err
|
|
}
|