B: update webhooks to avoid 404
This commit is contained in:
parent
563b935fe7
commit
374826b577
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
// gets all current subscriptions
|
// gets all current subscriptions
|
||||||
func (api *PcoApiClient) GetSubscriptions() ([]webhooks.Subscription, error) {
|
func (api *PcoApiClient) GetSubscriptions() ([]webhooks.Subscription, error) {
|
||||||
api.Url().Path = "/webhook/v2/subscriptions"
|
api.Url().Path = "/webhooks/v2/subscriptions"
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodGet, api.Url().String(), nil)
|
req, err := http.NewRequest(http.MethodGet, api.Url().String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -24,7 +24,7 @@ func (api *PcoApiClient) GetSubscriptions() ([]webhooks.Subscription, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp.StatusCode > 299 || resp.StatusCode < 200 {
|
if resp.StatusCode > 299 || resp.StatusCode < 200 {
|
||||||
return nil, fmt.Errorf("Failed to retrieve plan with status code: %d", resp.StatusCode)
|
return nil, fmt.Errorf("Failed to retrieve subscriptions with status code: %d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
subscriptions, err := jsonapi.UnmarshalManyPayload[webhooks.Subscription](resp.Body)
|
subscriptions, err := jsonapi.UnmarshalManyPayload[webhooks.Subscription](resp.Body)
|
||||||
|
@ -37,7 +37,7 @@ func (api *PcoApiClient) GetSubscriptions() ([]webhooks.Subscription, error) {
|
||||||
|
|
||||||
// Posts subscriptions to PCO api and returns a new list of subscriptions
|
// Posts subscriptions to PCO api and returns a new list of subscriptions
|
||||||
func (api *PcoApiClient) CreateSubscriptions(subscriptions []webhooks.Subscription) ([]webhooks.Subscription, error) {
|
func (api *PcoApiClient) CreateSubscriptions(subscriptions []webhooks.Subscription) ([]webhooks.Subscription, error) {
|
||||||
api.Url().Path = "/webhook/v2/subscriptions"
|
api.Url().Path = "/webhooks/v2/subscriptions"
|
||||||
|
|
||||||
body := bytes.NewBuffer([]byte{})
|
body := bytes.NewBuffer([]byte{})
|
||||||
err := jsonapi.MarshalPayload(body, subscriptions)
|
err := jsonapi.MarshalPayload(body, subscriptions)
|
||||||
|
@ -69,7 +69,7 @@ func (api *PcoApiClient) CreateSubscriptions(subscriptions []webhooks.Subscripti
|
||||||
|
|
||||||
// Posts subcription to PCO api and updates the subscription at the pointer that was passed to the fuinction with the server response
|
// Posts subcription to PCO api and updates the subscription at the pointer that was passed to the fuinction with the server response
|
||||||
func (api *PcoApiClient) CreateSubscription(subscription *webhooks.Subscription) error {
|
func (api *PcoApiClient) CreateSubscription(subscription *webhooks.Subscription) error {
|
||||||
api.Url().Path = "/webhook/v2/subscriptions"
|
api.Url().Path = "/webhooks/v2/subscriptions"
|
||||||
|
|
||||||
body := bytes.NewBuffer([]byte{})
|
body := bytes.NewBuffer([]byte{})
|
||||||
err := jsonapi.MarshalPayload(body, subscription)
|
err := jsonapi.MarshalPayload(body, subscription)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"webhook_version": "0.0.21",
|
"webhook_version": "0.0.23",
|
||||||
"frontend_version": "0.0.21"
|
"frontend_version": "0.0.23"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue