diff --git a/arlo.go b/arlo.go index 2d083b1..d057378 100644 --- a/arlo.go +++ b/arlo.go @@ -94,7 +94,7 @@ func (a *Arlo) GetDevices() (Devices, error) { deviceResponse.Data[i].arlo = a } - // Unsubscribe all of the basestations to the EventStream. + // Unsubscribe all of the basestations from the EventStream. for i := range a.Basestations { if err := a.Basestations[i].Unsubscribe(); err != nil { return nil, errors.WithMessage(err, "failed to get devices") diff --git a/events_stream.go b/events_stream.go index 8efcc51..b8119dc 100644 --- a/events_stream.go +++ b/events_stream.go @@ -3,7 +3,6 @@ package arlo import ( "bytes" "encoding/json" - "fmt" "net/http" "sync" @@ -51,7 +50,6 @@ func (e *EventStream) Listen() (connected chan bool) { go func() { err := e.SSEClient.SubscribeChanRaw(e.Events) if err != nil { - fmt.Println(FAILED_TO_SUBSCRIBE) e.Error <- FAILED_TO_SUBSCRIBE } diff --git a/library.go b/library.go index 2b0de7b..706c414 100644 --- a/library.go +++ b/library.go @@ -39,7 +39,7 @@ type Library []Recording func (a *Arlo) GetLibraryMetaData(fromDate, toDate time.Time) (*LibraryMetaDataResponse, error) { body := map[string]string{"dateFrom": fromDate.Format("20060102"), "dateTo": toDate.Format("20060102")} - resp, err := a.client.Post(LibraryMetadataUri, body, nil) + resp, err := a.post(LibraryMetadataUri, "", body, nil) if err != nil { return nil, errors.WithMessage(err, "failed to get library metadata") @@ -56,7 +56,7 @@ func (a *Arlo) GetLibraryMetaData(fromDate, toDate time.Time) (*LibraryMetaDataR func (a *Arlo) GetLibrary(fromDate, toDate time.Time) (*LibraryResponse, error) { body := map[string]string{"dateFrom": fromDate.Format("20060102"), "dateTo": toDate.Format("20060102")} - resp, err := a.client.Post(LibraryUri, body, nil) + resp, err := a.post(LibraryUri, "", body, nil) if err != nil { return nil, errors.WithMessage(err, "failed to get library") } @@ -79,7 +79,7 @@ func (a *Arlo) GetLibrary(fromDate, toDate time.Time) (*LibraryResponse, error) func (a *Arlo) DeleteRecording(r Recording) (*Error, error) { body := map[string]Library{"data": {r}} - resp, err := a.client.Post(LibraryRecycleUri, body, nil) + resp, err := a.post(LibraryRecycleUri, "", body, nil) if err != nil { return nil, errors.WithMessage(err, "failed to delete recording") } @@ -102,7 +102,7 @@ func (a *Arlo) DeleteRecording(r Recording) (*Error, error) { func (a *Arlo) BatchDeleteRecordings(l Library) (*Error, error) { body := map[string]Library{"data": l} - resp, err := a.client.Post(LibraryRecycleUri, body, nil) + resp, err := a.post(LibraryRecycleUri, "", body, nil) if err != nil { return nil, errors.WithMessage(err, "failed to delete recordings") }