github.com/abemedia/appcast@v0.4.0/integrations/appinstaller/types.go (about)

     1  package appinstaller
     2  
     3  import "encoding/xml"
     4  
     5  type AppInstaller struct {
     6  	XMLName          xml.Name
     7  	Version          string `xml:",attr"`
     8  	URI              string `xml:"Uri,attr"`
     9  	MainBundle       *Package
    10  	MainPackage      *Package
    11  	Dependencies     *Packages
    12  	OptionalPackages *Packages
    13  	RelatedPackages  *Packages
    14  	UpdateSettings   *UpdateSettings
    15  }
    16  
    17  func (ai *AppInstaller) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
    18  	start.Name.Local = "AppInstaller"
    19  	start.Name.Space = ai.XMLName.Space
    20  	return enc.EncodeElement(*ai, start)
    21  }
    22  
    23  type Packages struct {
    24  	Bundle  []*Package
    25  	Package []*Package
    26  }
    27  
    28  type Package struct {
    29  	Name                  string `xml:",attr"`
    30  	Publisher             string `xml:",attr"`
    31  	Version               string `xml:",attr"`
    32  	ProcessorArchitecture string `xml:",attr,omitempty"`
    33  	URI                   string `xml:"Uri,attr"`
    34  }
    35  
    36  type UpdateSettings struct {
    37  	OnLaunch                  *OnLaunch
    38  	AutomaticBackgroundTask   Bool `xml:",omitempty"`
    39  	ForceUpdateFromAnyVersion bool `xml:",omitempty"`
    40  }
    41  
    42  type OnLaunch struct {
    43  	HoursBetweenUpdateChecks int  `xml:",attr,omitempty"`
    44  	ShowPrompt               bool `xml:",attr,omitempty"`
    45  	UpdateBlocksActivation   bool `xml:",attr,omitempty"`
    46  }
    47  
    48  type Bool bool
    49  
    50  func (xb *Bool) MarshalText() ([]byte, error) {
    51  	return nil, nil
    52  }
    53  
    54  func (xb *Bool) UnmarshalText([]byte) error {
    55  	*xb = true
    56  	return nil
    57  }