func()

in internal/client/apikeys.go [14:36]


func (c *Client) GetApiKeys() ([]ApiKey, error) {
	req, err := http.NewRequest("GET", fmt.Sprintf("%s/api-keys", c.HostURL), nil)
	if err != nil {
		return nil, err
	}

	body, err := c.doRequest(req)
	if err != nil {
		return nil, err
	}

	apiKeys := []ApiKey{}
	err = json.Unmarshal(body, &struct {
		ApiKeys *[]ApiKey `json:"apikeys"`
	}{
		ApiKeys: &apiKeys,
	})
	if err != nil {
		return nil, err
	}

	return apiKeys, nil
}