forked from openpitrix/openpitrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metadata.go
106 lines (91 loc) · 2.02 KB
/
metadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright 2018 The OpenPitrix Authors. All rights reserved.
// Use of this source code is governed by a Apache license
// that can be found in the LICENSE file.
package opapp
import "fmt"
type Metadata struct {
ApiVersion string `json:"api_version,omitempty"`
Name string `json:"name"`
Version string `json:"version"`
AppVersion string `json:"app_version,omitempty"`
Description string `json:"description,omitempty"`
Home string `json:"home,omitempty"`
Icon string `json:"icon,omitempty"`
Maintainers []*Maintainer `json:"maintainers,omitempty"`
Screenshots []string `json:"screenshots,omitempty"`
Keywords []string `json:"keywords,omitempty"`
Sources []string `json:"sources,omitempty"`
}
type Maintainer struct {
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
}
func (m *Metadata) GetAppVersion() string {
if m != nil {
return m.AppVersion
}
return ""
}
func (m *Metadata) GetApiVersion() string {
if m != nil {
return m.ApiVersion
}
return ""
}
func (m *Metadata) GetIcon() string {
if m != nil {
return m.Icon
}
return ""
}
func (m *Metadata) GetMaintainers() []*Maintainer {
if m != nil {
return m.Maintainers
}
return nil
}
func (m *Metadata) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Metadata) GetHome() string {
if m != nil {
return m.Home
}
return ""
}
func (m *Metadata) GetSources() []string {
if m != nil {
return m.Sources
}
return nil
}
func (m *Metadata) GetKeywords() []string {
if m != nil {
return m.Keywords
}
return nil
}
func (m *Metadata) GetVersion() string {
if m != nil {
return m.Version
}
return ""
}
func (m *Metadata) GetDescription() string {
if m != nil {
return m.Description
}
return ""
}
func (m *Metadata) GetScreenshots() []string {
if m != nil {
return m.Screenshots
}
return []string{}
}
func (m *Metadata) GetPackageName() string {
return fmt.Sprintf("%s-%s.tgz", m.Name, m.Version)
}