models

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldZIP          = "ZIP"
	FieldZIPMirrors   = "ZIPMirrors"
	FieldMD5          = "MD5"
	FieldVersionInfo  = "VersionInfo"
	FieldSourceReport = "SourceReport"
	FieldError        = "Error"
)

Public consts

View Source
const (
	DateOnlyFormat    = "20060102"
	HumanDateTemplate = "%d %s %d"
)

Public consts

Variables

View Source
var TemplateMap = map[string]string{
	FieldZIP:          pkgTemplate + zipExtension,
	FieldZIPMirrors:   pkgTemplate + zipExtension,
	FieldMD5:          pkgTemplate + md5Extension,
	FieldVersionInfo:  pkgTemplate + logExtension,
	FieldSourceReport: reportTemplate,
}

TemplateMap holds format templates

Functions

func NewDownloadLink(field, date string, p gapps.Platform, a gapps.Android, v gapps.Variant) string

NewDownloadLink returns a download link per provided parameters

Types

type APIRecord

type APIRecord struct {
	VariantList []APIVariant `json:"variants"`
}

APIRecord holds all of the gapps Variants

type APIVariant

type APIVariant struct {
	Name         string `json:"name"`
	ZIP          string `json:"zip"`
	ZIPSize      int64  `json:"zip_size"`
	MD5          string `json:"md5"`
	VersionInfo  string `json:"version_info"`
	SourceReport string `json:"source_report"`
}

APIVariant describes gapps Variant

func NewAPIVariant added in v1.5.0

func NewAPIVariant(date string, p gapps.Platform, a gapps.Android, v gapps.Variant) APIVariant

NewAPIVariant creates and prepares new APIVariant

type ArchRecord

type ArchRecord struct {
	APIList   map[string]APIRecord `json:"apis"`
	Date      string               `json:"date"`
	HumanDate string               `json:"human_date"`
}

ArchRecord holds the list of gapps Variants per API and its date

type DownloadResponse

type DownloadResponse struct {
	ZIP          string `json:"zip,omitempty"`
	ZIPMirrors   string `json:"zip_mirrors,omitempty"`
	MD5          string `json:"md5,omitempty"`
	VersionInfo  string `json:"version_info,omitempty"`
	SourceReport string `json:"source_report,omitempty"`
	Error        string `json:"error,omitempty"`
	// contains filtered or unexported fields
}

DownloadResponse is used for the /download endpoint

func (*DownloadResponse) HasCriticalError

func (r *DownloadResponse) HasCriticalError() bool

HasCriticalError reports if we had an error which lead to the missing link

func (*DownloadResponse) SetField

func (r *DownloadResponse) SetField(field, value string)

SetField safely sets the field value

func (*DownloadResponse) ToJSON

func (r *DownloadResponse) ToJSON() []byte

ToJSON forms JSON body from a struct, ignoring Marshal error

type ListResponse

type ListResponse struct {
	ArchList map[string]ArchRecord `json:"archs,omitempty"`
	Error    string                `json:"error,omitempty"`
	// contains filtered or unexported fields
}

ListResponse is used for the /list endpoint

func (*ListResponse) AddPackage

func (r *ListResponse) AddPackage(date string, p gapps.Platform, a gapps.Android, v gapps.Variant) error

AddPackage safely adds the package to the ListResponse

func (*ListResponse) ToJSON

func (r *ListResponse) ToJSON() []byte

ToJSON forms JSON body from a struct, ignoring Marshal error

Jump to

Keyboard shortcuts

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