Adding persistent storage and working auth

Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
Kris Nóva 2021-02-03 21:01:21 -08:00
parent ba8188c7b9
commit 8829212093
9 changed files with 259 additions and 96 deletions

28
examples/photo.go Normal file
View file

@ -0,0 +1,28 @@
package main
import (
"encoding/json"
"fmt"
photoprism "github.com/kris-nova/client-go"
"github.com/kris-nova/logger"
)
func main() {
uuid := "pqnzigq156lndozm" // This is a known ID
client := photoprism.New(auth())
err := client.Login()
if err != nil {
halt(4, "Error logging into API: %v", err)
}
logger.Always("Login Success!")
photo, err := client.V1().GetPhoto(uuid)
if err != nil {
halt(3, "Error fetching photo: %v", err)
}
bytes, err := json.Marshal(photo)
if err != nil {
halt(5, "Error: %v", err)
}
fmt.Println(string(bytes))
}