func()

in internal/client/apikeys.go [66:87]


func (c *Client) DeleteApiKey(id string) error {
	req, err := http.NewRequest("DELETE", fmt.Sprintf("%s/api-keys/%s", c.HostURL, id), nil)
	if err != nil {
		return err
	}

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

	jsonBody := JsonBody{}
	err = json.Unmarshal(body, &jsonBody)
	if err != nil {
		return err
	}
	if !jsonBody.Success {
		return errors.New(jsonBody.Message)
	}

	return nil
}