gitea

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReleaseNotFound = errors.New("release not found")
	ErrFileExists      = errors.New("asset file already exist")
)

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	ListReleases(owner, repo string, opt gitea.ListReleasesOptions) ([]*gitea.Release, *gitea.Response, error)
	CreateRelease(owner, repo string, opt gitea.CreateReleaseOption) (*gitea.Release, *gitea.Response, error)
	ListReleaseAttachments(user, repo string, release int64, opt gitea.ListReleaseAttachmentsOptions) ([]*gitea.Attachment, *gitea.Response, error)
	CreateReleaseAttachment(user, repo string, release int64, file io.Reader, filename string) (*gitea.Attachment, *gitea.Response, error)
	DeleteReleaseAttachment(user, repo string, release, id int64) (*gitea.Response, error)
}

type Client

type Client struct {
	Release *Release
	// contains filtered or unexported fields
}

func NewClient

func NewClient(url, key string, client *http.Client) (*Client, error)

NewClient creates a new Client instance with the provided Gitea client.

type FileExists

type FileExists string
const (
	FileExistsOverwrite FileExists = "overwrite"
	FileExistsFail      FileExists = "fail"
	FileExistsSkip      FileExists = "skip"
)

type Release

type Release struct {
	Opt ReleaseOptions
	// contains filtered or unexported fields
}

func (*Release) AddAttachments

func (r *Release) AddAttachments(releaseID int64, files []string) error

AddAttachments uploads the specified files as attachments to the release with the given ID. It first checks for any existing attachments with the same names, and handles them according to the FileExists option:

- "overwrite": overwrites the existing attachment - "fail": returns an error if the file already exists - "skip": skips uploading the file and logs a warning

If there are no conflicts, it uploads the new files as attachments to the release.

func (*Release) Create

func (r *Release) Create() (*gitea.Release, error)

Create creates a new release on the Gitea repository with the specified options. It returns the created release or an error if the creation failed.

func (*Release) Find

func (r *Release) Find() (*gitea.Release, error)

Find retrieves the release with the specified tag name from the repository. If the release is not found, it returns an ErrReleaseNotFound error.

type ReleaseOptions

type ReleaseOptions struct {
	Owner      string
	Repo       string
	Tag        string
	Draft      bool
	Prerelease bool
	FileExists string
	Title      string
	Note       string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL