func (api *API) CreateWebhook(wh webhook.Type) (*webhook.Type, error) {
	// ID is set by the server
	wh.ID = ""
	data, err := json.Marshal(wh)
	if err != nil {
		return nil, err
	}

	url := fmt.Sprintf("/account/%s/webhook", wh.Account.String())
	body, statusCode, err := api.Post(url, data)
	if err != nil {
		return nil, err
	}

	if statusCode < 200 || statusCode > 299 {
		return nil, errNoSuccess
	}

	if isErrorResponse(body) {
		return nil, GetErrorFromResponse(body)
	}

	fmt.Println(body)

	return &wh, nil
}
// CreateWebhook Create a new API key
CreateWebhook Create a new API key
// CreateWebhook Create a new API key
func (api *API) CreateWebhook(wh webhook.Type) (*webhook.Type, error) {
	wh.ID = ""
	data, err := json.Marshal(wh)
	if err != nil {
		return nil, err
	}
	url := fmt.Sprintf("/account/%s/webhook", wh.Account.String())
	body, statusCode, err := api.Post(url, data)
	if err != nil {
		return nil, err
	}
	if statusCode < 200 || statusCode > 299 {
		return nil, errNoSuccess
	}
	if isErrorResponse(body) {
		return nil, GetErrorFromResponse(body)
	}
	fmt.Println(body)
	return &wh, nil
}
func ( api * API ) CreateWebhook ( wh webhook . Type ) ( * webhook . Type , error ) { wh . ID = " " data , err := json . Marshal ( wh ) if err != nil { return nil , err } url := fmt . Sprintf ( " " , wh . Account . String ( ) ) body , statusCode , err := api . Post ( url , data ) if err != nil { return nil , err } if statusCode < 200 || statusCode > 299 { return nil , errNoSuccess } if isErrorResponse ( body ) { return nil , GetErrorFromResponse ( body ) } fmt . Println ( body ) return & wh , nil }
CreateWebhook Create a new API key
CreateWebhook Create a new API key
// ID is set by the server