(body []byte, target *T)
| 70 | } |
| 71 | |
| 72 | func ParseResp[T any](body []byte, target *T) error { |
| 73 | |
| 74 | if err := json.Unmarshal(body, target); err != nil { |
| 75 | slog.Debug("response info", logging.RuntimeAttr(string(body))) |
| 76 | return fmt.Errorf("error unmarshaling response body: %s", err.Error()) |
| 77 | } |
| 78 | return nil |
| 79 | } |
| 80 | |
| 81 | // DownloadFile downloads a URL to destPath, creating parent directories as needed. |
| 82 | // No-op if destPath already exists. Returns the resolved local path on success. |
no test coverage detected