(url string)
| 50 | } |
| 51 | |
| 52 | func getModelStatus(url string) (response map[string]any) { |
| 53 | // Create the HTTP request |
| 54 | req, err := http.NewRequest("GET", url, nil) |
| 55 | req.Header.Set("Content-Type", "application/json") |
| 56 | req.Header.Set("Authorization", bearerKey) |
| 57 | if err != nil { |
| 58 | fmt.Println("Error creating request:", err) |
| 59 | return |
| 60 | } |
| 61 | client := &http.Client{} |
| 62 | resp, err := client.Do(req) |
| 63 | if err != nil { |
| 64 | fmt.Println("Error sending request:", err) |
| 65 | return |
| 66 | } |
| 67 | defer resp.Body.Close() |
| 68 | |
| 69 | body, err := io.ReadAll(resp.Body) |
| 70 | if err != nil { |
| 71 | fmt.Println("Error reading response body:", err) |
| 72 | return |
| 73 | } |
| 74 | |
| 75 | // Unmarshal the response into a map[string]interface{} |
| 76 | err = json.Unmarshal(body, &response) |
| 77 | if err != nil { |
| 78 | fmt.Println("Error unmarshaling JSON response:", err) |
| 79 | return |
| 80 | } |
| 81 | return |
| 82 | } |
| 83 | |
| 84 | func getModels(url string) ([]gallery.GalleryModel, error) { |
| 85 | response := []gallery.GalleryModel{} |
no test coverage detected