ExportData returns the requested fields for --json output. Fields the API returned as null stay null.
(fields []string)
| 102 | // ExportData returns the requested fields for --json output. Fields the API |
| 103 | // returned as null stay null. |
| 104 | func (a Artifact) ExportData(fields []string) map[string]any { |
| 105 | data := map[string]any{} |
| 106 | for _, f := range fields { |
| 107 | switch f { |
| 108 | case "body": |
| 109 | data[f] = a.Body |
| 110 | case "bodyHtml": |
| 111 | data[f] = a.BodyHTML |
| 112 | case "createdAt": |
| 113 | data[f] = a.CreatedAt |
| 114 | case "creator": |
| 115 | data[f] = a.Creator.export() |
| 116 | case "description": |
| 117 | data[f] = a.Description |
| 118 | case "id": |
| 119 | data[f] = a.ID |
| 120 | case "name": |
| 121 | data[f] = a.Name |
| 122 | case "number": |
| 123 | data[f] = a.Number |
| 124 | case "type": |
| 125 | data[f] = a.Type |
| 126 | case "updatedAt": |
| 127 | data[f] = a.UpdatedAt |
| 128 | case "updatedByActor": |
| 129 | data[f] = a.UpdatedByActor.export() |
| 130 | case "url": |
| 131 | data[f] = a.URL |
| 132 | } |
| 133 | } |
| 134 | return data |
| 135 | } |
| 136 | |
| 137 | // ExportData returns the requested fields for --json output, where versions |
| 138 | // is the edit history, newest first. Fields the API returned as null stay |