2021-09-14 13:58:48 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
|
|
)
|
|
|
|
|
2023-12-06 21:07:03 +00:00
|
|
|
// ListSoftwareVersions retrieves the software versions installed on hosts.
|
|
|
|
func (c *Client) ListSoftwareVersions(query string) ([]fleet.Software, error) {
|
2023-12-06 14:30:49 +00:00
|
|
|
verb, path := "GET", "/api/latest/fleet/software/versions"
|
|
|
|
var responseBody listSoftwareVersionsResponse
|
2021-09-14 13:58:48 +00:00
|
|
|
err := c.authenticatedRequestWithQuery(nil, verb, path, &responseBody, query)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return responseBody.Software, nil
|
|
|
|
}
|
2023-12-06 21:07:03 +00:00
|
|
|
|
|
|
|
// ListSoftwareTitles retrieves the software titles installed on hosts.
|
|
|
|
func (c *Client) ListSoftwareTitles(query string) ([]fleet.SoftwareTitle, error) {
|
|
|
|
verb, path := "GET", "/api/latest/fleet/software/titles"
|
|
|
|
var responseBody listSoftwareTitlesResponse
|
|
|
|
err := c.authenticatedRequestWithQuery(nil, verb, path, &responseBody, query)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return responseBody.SoftwareTitles, nil
|
|
|
|
}
|