github.com/creativeprojects/go-selfupdate@v1.2.0/source.go (about)

     1  package selfupdate
     2  
     3  import (
     4  	"context"
     5  	"io"
     6  	"time"
     7  )
     8  
     9  // Source interface to load the releases from (GitHubSource for example)
    10  type Source interface {
    11  	ListReleases(ctx context.Context, repository Repository) ([]SourceRelease, error)
    12  	DownloadReleaseAsset(ctx context.Context, rel *Release, assetID int64) (io.ReadCloser, error)
    13  }
    14  
    15  type SourceRelease interface {
    16  	GetID() int64
    17  	GetTagName() string
    18  	GetDraft() bool
    19  	GetPrerelease() bool
    20  	GetPublishedAt() time.Time
    21  	GetReleaseNotes() string
    22  	GetName() string
    23  	GetURL() string
    24  
    25  	GetAssets() []SourceAsset
    26  }
    27  
    28  type SourceAsset interface {
    29  	GetID() int64
    30  	GetName() string
    31  	GetSize() int
    32  	GetBrowserDownloadURL() string
    33  }