ExportData returns the requested fields for --json output, where versions is the edit history, newest first. Fields the API returned as null stay null.
(fields []string)
| 138 | // is the edit history, newest first. Fields the API returned as null stay |
| 139 | // null. |
| 140 | func (a ArtifactWithVersions) ExportData(fields []string) map[string]any { |
| 141 | data := a.Artifact.ExportData(fields) |
| 142 | if slices.Contains(fields, "versions") { |
| 143 | versions := make([]map[string]any, 0, len(a.Versions)) |
| 144 | for _, v := range a.Versions { |
| 145 | versions = append(versions, v.export()) |
| 146 | } |
| 147 | data["versions"] = versions |
| 148 | } |
| 149 | return data |
| 150 | } |
| 151 | |
| 152 | func (v Version) export() map[string]any { |
| 153 | return map[string]any{ |
nothing calls this directly
no test coverage detected