in internal/client/apikeys.go [39:63]
func (c *Client) CreateApiKey(apiKeyCreate ApiKeyCreate) (*ApiKey, error) {
rb, err := json.Marshal(apiKeyCreate)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", fmt.Sprintf("%s/api-keys", c.HostURL), strings.NewReader(string(rb)))
if err != nil {
return nil, err
}
req.Header.Add("content-type", "application/json")
body, err := c.doRequest(req)
if err != nil {
return nil, err
}
apiKey := ApiKey{}
err = json.Unmarshal(body, &apiKey)
if err != nil {
return nil, err
}
return &apiKey, nil
}