decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T, returning a nil slice when the body is empty.
(r io.Reader)
| 1161 | // decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T, |
| 1162 | // returning a nil slice when the body is empty. |
| 1163 | func decodeNDJSONMetrics[T any](r io.Reader) ([]*T, error) { |
| 1164 | var records []*T |
| 1165 | dec := json.NewDecoder(r) |
| 1166 | for { |
| 1167 | var rec *T |
| 1168 | if err := dec.Decode(&rec); err != nil { |
| 1169 | if errors.Is(err, io.EOF) { |
| 1170 | break |
| 1171 | } |
| 1172 | return nil, err |
| 1173 | } |
| 1174 | records = append(records, rec) |
| 1175 | } |
| 1176 | return records, nil |
| 1177 | } |
| 1178 | |
| 1179 | // DownloadDailyMetrics downloads the payload of a 1-day Copilot usage metrics report from a |
| 1180 | // download link returned by GetEnterpriseDailyMetricsReport or GetOrganizationDailyMetricsReport. |
nothing calls this directly
no test coverage detected
searching dependent graphs…