code.gitea.io/gitea@v1.19.3/modules/migration/release.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package migration
     5  
     6  import (
     7  	"io"
     8  	"time"
     9  )
    10  
    11  // ReleaseAsset represents a release asset
    12  type ReleaseAsset struct {
    13  	ID            int64
    14  	Name          string
    15  	ContentType   *string `yaml:"content_type"`
    16  	Size          *int
    17  	DownloadCount *int `yaml:"download_count"`
    18  	Created       time.Time
    19  	Updated       time.Time
    20  
    21  	DownloadURL *string `yaml:"download_url"` // SECURITY: It is the responsibility of downloader to make sure this is safe
    22  	// if DownloadURL is nil, the function should be invoked
    23  	DownloadFunc func() (io.ReadCloser, error) `yaml:"-"` // SECURITY: It is the responsibility of downloader to make sure this is safe
    24  }
    25  
    26  // Release represents a release
    27  type Release struct {
    28  	TagName         string `yaml:"tag_name"`         // SECURITY: This must pass git.IsValidRefPattern
    29  	TargetCommitish string `yaml:"target_commitish"` // SECURITY: This must pass git.IsValidRefPattern
    30  	Name            string
    31  	Body            string
    32  	Draft           bool
    33  	Prerelease      bool
    34  	PublisherID     int64  `yaml:"publisher_id"`
    35  	PublisherName   string `yaml:"publisher_name"`
    36  	PublisherEmail  string `yaml:"publisher_email"`
    37  	Assets          []*ReleaseAsset
    38  	Created         time.Time
    39  	Published       time.Time
    40  }
    41  
    42  // GetExternalName ExternalUserMigrated interface
    43  func (r *Release) GetExternalName() string { return r.PublisherName }
    44  
    45  // GetExternalID ExternalUserMigrated interface
    46  func (r *Release) GetExternalID() int64 { return r.PublisherID }