Compare commits

...

8 commits
v1.0.0 ... main

Author SHA1 Message Date
4e41e5f1a1 Update api/v1/types.go 2024-06-28 18:59:13 +02:00
b86e9d96cf Update go to 1.21.1 2024-06-06 09:18:46 +01:00
46591ba762 Misc 2024-05-27 17:58:30 +01:00
39ebac8aa4 Update logger 2023-02-08 13:11:21 +00:00
700a2e8e25 Update logger 2023-02-08 13:11:06 +00:00
691d8ae483 Remove junk from struct 2023-02-08 13:07:28 +00:00
353a9769ad Update logger import path 2023-02-08 13:07:22 +00:00
4c9b6afa1b Update README 2023-01-18 00:51:48 +00:00
11 changed files with 31 additions and 27 deletions

View file

@ -10,7 +10,7 @@ Go client for the Photoprism Application.
```bash ```bash
go get github.com/astravexton/photoprism-client-go go get git.zio.sh/astra/photoprism-client-go
``` ```
@ -59,12 +59,12 @@ import (
"io/ioutil" "io/ioutil"
"path" "path"
photoprism "github.com/astravexton/photoprism-client-go" photoprism "git.zio.sh/astra/photoprism-client-go"
"github.com/astravexton/logger" "git.zio.sh/astra/logger"
) )
func main() func main()
logger.Level = 4 logger.BitwiseLevel = logger.LogEverything
uuid := "pqnzigq351j2fqgn" // This is a known ID uuid := "pqnzigq351j2fqgn" // This is a known ID
client := photoprism.New("http://localhost:8080") client := photoprism.New("http://localhost:8080")
@ -111,10 +111,3 @@ func main()
} }
``` ```
# Pipeline
- [ ] Upload photo methods/tests
- [ ] Code generation
- [ ] Finish the remaining methods

View file

@ -220,7 +220,7 @@ type File struct {
type PhotoLabel struct { type PhotoLabel struct {
PhotoID uint `json:"PhotoID"` PhotoID uint `json:"PhotoID"`
LabelID uint `json:"LabelID"` LabelID uint `json:"LabelID"`
LabelSrc string `json:"LabelSrc""` LabelSrc string `json:"LabelSrc"`
Uncertainty int `json:"Uncertainty"` Uncertainty int `json:"Uncertainty"`
Photo *Photo `json:"Photo"` Photo *Photo `json:"Photo"`
Label *Label `json:"Label"` Label *Label `json:"Label"`

View file

@ -147,9 +147,12 @@ func (c *Client) LoginV1() error {
} }
token := resp.Header.Get(APIAuthHeaderKey) token := resp.Header.Get(APIAuthHeaderKey)
if token == "" { if token == "" && cfg.AccessToken == "" {
return fmt.Errorf("missing auth token from successful login") return fmt.Errorf("missing auth token from successful login")
} }
if cfg.AccessToken != "" {
token = cfg.AccessToken
}
c.v1client = v1.New(c.connectionURL, token, cfg.Config.DownloadToken) c.v1client = v1.New(c.connectionURL, token, cfg.Config.DownloadToken)
return nil return nil
} }

View file

@ -1,9 +1,9 @@
package main package main
import ( import (
"git.zio.sh/astra/logger"
photoprism "git.zio.sh/astra/photoprism-client-go" photoprism "git.zio.sh/astra/photoprism-client-go"
"git.zio.sh/astra/photoprism-client-go/api/v1" "git.zio.sh/astra/photoprism-client-go/api/v1"
"github.com/astravexton/logger"
) )
func main() { func main() {

View file

@ -6,7 +6,7 @@ import (
photoprism "git.zio.sh/astra/photoprism-client-go" photoprism "git.zio.sh/astra/photoprism-client-go"
"github.com/astravexton/logger" "git.zio.sh/astra/logger"
) )
// format string, a ...interface{} // format string, a ...interface{}

View file

@ -3,8 +3,8 @@ package main
import ( import (
"fmt" "fmt"
"git.zio.sh/astra/logger"
photoprism "git.zio.sh/astra/photoprism-client-go" photoprism "git.zio.sh/astra/photoprism-client-go"
"github.com/astravexton/logger"
) )
func main() { func main() {

View file

@ -1,8 +1,8 @@
package main package main
import ( import (
"git.zio.sh/astra/logger"
photoprism "git.zio.sh/astra/photoprism-client-go" photoprism "git.zio.sh/astra/photoprism-client-go"
"github.com/astravexton/logger"
) )
func main() { func main() {

View file

@ -5,8 +5,8 @@ import (
"io/ioutil" "io/ioutil"
"path" "path"
"git.zio.sh/astra/logger"
photoprism "git.zio.sh/astra/photoprism-client-go" photoprism "git.zio.sh/astra/photoprism-client-go"
"github.com/astravexton/logger"
) )
func main() { func main() {

11
go.mod
View file

@ -1,5 +1,10 @@
module git.zio.sh/astra/photoprism-client-go module git.zio.sh/astra/photoprism-client-go/v2
go 1.18 go 1.21.1
require github.com/astravexton/logger v0.2.2-0.20211216142523-c1e08a465709 // indirect require git.zio.sh/astra/logger v1.0.1
require (
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
)

10
go.sum
View file

@ -1,8 +1,10 @@
github.com/astravexton/logger v0.2.2-0.20211216142523-c1e08a465709 h1:S+dBCax7wdg3ikWx5t6cClPKQIerrmD404qAzWhO2V4= git.zio.sh/astra/logger v1.0.1 h1:vEdHDT5L8n6rHihVblJ9Be1AtGQvKK9tzPHeX4DEBCw=
github.com/astravexton/logger v0.2.2-0.20211216142523-c1e08a465709/go.mod h1:6BlG5E0U3CImXLmDtGpEwdoc8PHiiDv0kbvJBCbfiMY= git.zio.sh/astra/logger v1.0.1/go.mod h1:4FJwzSIWGI8S0HxwSns5r+tuS7GcKAe78AjeEKEjt10=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg=
github.com/kris-nova/lolgopher v0.0.0-20210112022122-73f0047e8b65/go.mod h1:V0HF/ZBlN86HqewcDC/cVxMmYDiRukWjSrgKLUAn9Js= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View file

@ -1,7 +1,8 @@
package photoprism package photoprism
type Config struct { type Config struct {
Config *Options `json:"config"` Config *Options `json:"config"`
AccessToken string `json:"access_token"`
} }
type Options struct { type Options struct {
@ -68,7 +69,7 @@ type Options struct {
//FFmpegBin string `yaml:"FFmpegBin" json:"-" flag:"ffmpeg-bin"` //FFmpegBin string `yaml:"FFmpegBin" json:"-" flag:"ffmpeg-bin"`
//ExifToolBin string `yaml:"ExifToolBin" json:"-" flag:"exiftool-bin"` //ExifToolBin string `yaml:"ExifToolBin" json:"-" flag:"exiftool-bin"`
//DetachServer bool `yaml:"DetachServer" json:"-" flag:"detach-server"` //DetachServer bool `yaml:"DetachServer" json:"-" flag:"detach-server"`
DownloadToken string `yaml:"DownloadToken" json:"downloadToken" flag:"download-token"` DownloadToken string `json:"downloadToken"`
//PreviewToken string `yaml:"PreviewToken" json:"-" flag:"preview-token"` //PreviewToken string `yaml:"PreviewToken" json:"-" flag:"preview-token"`
//ThumbFilter string `yaml:"ThumbFilter" json:"ThumbFilter" flag:"thumb-filter"` //ThumbFilter string `yaml:"ThumbFilter" json:"ThumbFilter" flag:"thumb-filter"`
//ThumbUncached bool `yaml:"ThumbUncached" json:"ThumbUncached" flag:"thumb-uncached"` //ThumbUncached bool `yaml:"ThumbUncached" json:"ThumbUncached" flag:"thumb-uncached"`