2019-05-06 19:12:51 -06:00
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 11:20:29 -07:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-05-06 19:12:51 -06:00
|
|
|
|
2021-11-16 08:25:33 -07:00
|
|
|
package migration
|
2019-05-06 19:12:51 -06:00
|
|
|
|
2020-12-26 20:34:19 -07:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"time"
|
|
|
|
)
|
2019-05-06 19:12:51 -06:00
|
|
|
|
|
|
|
// ReleaseAsset represents a release asset
|
|
|
|
type ReleaseAsset struct {
|
2020-08-27 19:36:37 -06:00
|
|
|
ID int64
|
2019-05-06 19:12:51 -06:00
|
|
|
Name string
|
2020-12-26 20:34:19 -07:00
|
|
|
ContentType *string `yaml:"content_type"`
|
2019-05-06 19:12:51 -06:00
|
|
|
Size *int
|
2020-12-26 20:34:19 -07:00
|
|
|
DownloadCount *int `yaml:"download_count"`
|
2019-05-06 19:12:51 -06:00
|
|
|
Created time.Time
|
|
|
|
Updated time.Time
|
2022-09-04 04:47:56 -06:00
|
|
|
|
|
|
|
DownloadURL *string `yaml:"download_url"` // SECURITY: It is the responsibility of downloader to make sure this is safe
|
2020-12-26 20:34:19 -07:00
|
|
|
// if DownloadURL is nil, the function should be invoked
|
2022-09-04 04:47:56 -06:00
|
|
|
DownloadFunc func() (io.ReadCloser, error) `yaml:"-"` // SECURITY: It is the responsibility of downloader to make sure this is safe
|
2019-05-06 19:12:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Release represents a release
|
|
|
|
type Release struct {
|
2022-09-04 04:47:56 -06:00
|
|
|
TagName string `yaml:"tag_name"` // SECURITY: This must pass git.IsValidRefPattern
|
|
|
|
TargetCommitish string `yaml:"target_commitish"` // SECURITY: This must pass git.IsValidRefPattern
|
2019-05-06 19:12:51 -06:00
|
|
|
Name string
|
|
|
|
Body string
|
|
|
|
Draft bool
|
|
|
|
Prerelease bool
|
2020-12-26 20:34:19 -07:00
|
|
|
PublisherID int64 `yaml:"publisher_id"`
|
|
|
|
PublisherName string `yaml:"publisher_name"`
|
|
|
|
PublisherEmail string `yaml:"publisher_email"`
|
|
|
|
Assets []*ReleaseAsset
|
2019-05-06 19:12:51 -06:00
|
|
|
Created time.Time
|
|
|
|
Published time.Time
|
|
|
|
}
|
2022-02-01 11:20:28 -07:00
|
|
|
|
|
|
|
// GetExternalName ExternalUserMigrated interface
|
|
|
|
func (r *Release) GetExternalName() string { return r.PublisherName }
|
|
|
|
|
|
|
|
// GetExternalID ExternalUserMigrated interface
|
|
|
|
func (r *Release) GetExternalID() int64 { return r.PublisherID }
|