118 lines
4.5 KiB
Go
118 lines
4.5 KiB
Go
package arlo
|
|
|
|
// LibraryMetaData is the library meta data.
|
|
type LibraryMetaData struct {
|
|
DateTo string `json:"dateTo"`
|
|
DateFrom string `json:"dateFrom"`
|
|
Meta map[string]map[string]Favorite `json:"meta"`
|
|
}
|
|
|
|
// presignedContentUrl is a link to the actual video in Amazon AWS.
|
|
// presignedThumbnailUrl is a link to the thumbnail .jpg of the actual video in Amazon AWS.
|
|
type Recording struct {
|
|
MediaDurationSecond int `json:"mediaDurationSecond"`
|
|
ContentType string `json:"contentType"`
|
|
Name string `json:"name"`
|
|
PresignedContentUrl string `json:"presignedContentUrl"`
|
|
LastModified int64 `json:"lastModified"`
|
|
LocalCreatedDate int64 `json:"localCreatedDate"`
|
|
PresignedThumbnailUrl string `json:"presignedThumbnailUrl"`
|
|
Reason string `json:"reason"`
|
|
DeviceId string `json:"deviceId"`
|
|
CreatedBy string `json:"createdBy"`
|
|
CreatedDate string `json:"createdDate"`
|
|
TimeZone string `json:"timeZone"`
|
|
OwnerId string `json:"ownerId"`
|
|
UtcCreatedDate int64 `json:"utcCreatedDate"`
|
|
CurrentState string `json:"currentState"`
|
|
MediaDuration string `json:"mediaDuration"`
|
|
UniqueId string `json:"uniqueId"`
|
|
}
|
|
|
|
type Library []Recording
|
|
|
|
//func (a *Arlo) GetLibraryMetaData(fromDate, toDate time.Time) (libraryMetaData *LibraryMetaData, err error) {
|
|
// msg := "failed to get library metadata"
|
|
//
|
|
// body := map[string]string{"dateFrom": fromDate.Format("20060102"), "dateTo": toDate.Format("20060102")}
|
|
// resp, err := a.post(MetadataUri, "", body, nil)
|
|
// if err != nil {
|
|
// return nil, errors.WithMessage(err, msg)
|
|
// }
|
|
// defer resp.Body.Close()
|
|
//
|
|
// response := new(LibraryMetaDataResponse)
|
|
// if err := resp.Decode(&response); err != nil {
|
|
// return nil, err
|
|
// }
|
|
//
|
|
// if !response.Success {
|
|
// return nil, errors.New(msg)
|
|
// }
|
|
//
|
|
// return &response.Data, nil
|
|
//}
|
|
//
|
|
//func (a *Arlo) GetLibrary(fromDate, toDate time.Time) (library *Library, err error) {
|
|
// msg := "failed to get library"
|
|
//
|
|
// body := map[string]string{"dateFrom": fromDate.Format("20060102"), "dateTo": toDate.Format("20060102")}
|
|
// resp, err := a.post(RecordingsUri, "", body, nil)
|
|
// if err != nil {
|
|
// return nil, errors.WithMessage(err, msg)
|
|
// }
|
|
// defer resp.Body.Close()
|
|
//
|
|
// response := new(LibraryResponse)
|
|
// if err := resp.Decode(&response); err != nil {
|
|
// return nil, err
|
|
// }
|
|
//
|
|
// if !response.Success {
|
|
// return nil, errors.New(msg)
|
|
// }
|
|
//
|
|
// return &response.Data, nil
|
|
//}
|
|
//
|
|
///*
|
|
// Delete a single video recording from arlo.
|
|
//
|
|
// All of the date info and device id you need to pass into this method are given in the results of the GetLibrary() call.
|
|
//
|
|
// NOTE: {"data": [{"createdDate": r.CreatedDate, "utcCreatedDate": r.UtcCreatedDate, "deviceId": r.DeviceId}]} is all that's really required.
|
|
//*/
|
|
//func (a *Arlo) DeleteRecording(r *Recording) error {
|
|
// body := map[string]Library{"data": {*r}}
|
|
// resp, err := a.post(RecycleUri, "", body, nil)
|
|
// return checkRequest(resp, err, "failed to delete recording")
|
|
//}
|
|
//
|
|
///*
|
|
// Delete a batch of video recordings from arlo.
|
|
//
|
|
// The GetLibrary() call response json can be passed directly to this method if you'd like to delete the same list of videos you queried for.
|
|
//
|
|
// NOTE: {"data": [{"createdDate": r.CreatedDate, "utcCreatedDate": r.UtcCreatedDate, "deviceId": r.DeviceId}]} is all that's really required.
|
|
//*/
|
|
//func (a *Arlo) BatchDeleteRecordings(l *Library) error {
|
|
// body := map[string]Library{"data": *l}
|
|
// resp, err := a.post(RecycleUri, "", body, nil)
|
|
// return checkRequest(resp, err, "failed to delete recordings")
|
|
//}
|
|
//
|
|
//// SendAnalyticFeedback is only really used by the GUI. It is a response to a prompt asking you whether an object which
|
|
//// was tagged by it's AI in your recording was tagged correctly.
|
|
//func (a *Arlo) SendAnalyticFeedback(r *Recording) error {
|
|
// category := "Person" // Other
|
|
// body := map[string]map[string]interface{}{"data": {"utcCreatedDate": r.UtcCreatedDate, "category": category, "createdDate": r.CreatedDate}}
|
|
// resp, err := a.put(AnalyticFeedbackUri, "", body, nil)
|
|
// return checkRequest(resp, err, "failed to send analytic feedback about recording")
|
|
//}
|
|
//
|
|
//// GetActiveAutomationDefinitions gets the mode metadata (this API replaces the older GetModes(), which still works).
|
|
//func (a *Arlo) GetActiveAutomationDefinitions() error {
|
|
// resp, err := a.get(ActiveAutomationUri, "", nil)
|
|
// return checkRequest(resp, err, "failed to get active automation definitions")
|
|
//}
|