func()

in intent.go [41:57]


func (c *Client) CreateIntent(name string) (*Intent, error) {
	intentJSON, err := json.Marshal(Intent{Name: name})
	if err != nil {
		return nil, err
	}

	resp, err := c.request(http.MethodPost, "/intents", "application/json", bytes.NewBuffer(intentJSON))
	if err != nil {
		return nil, err
	}

	defer resp.Close()

	var intentResp *Intent
	err = json.NewDecoder(resp).Decode(&intentResp)
	return intentResp, err
}