Add method to add label to photos

main
astravexton 2021-05-06 19:11:52 +01:00
parent 012ab74599
commit 9304897b69
3 changed files with 22 additions and 1 deletions

View File

@ -127,3 +127,19 @@ func (v1 *V1Client) PhotoPrimary(uuid, fileuuid string) error {
resp := v1.POST(nil, "/api/v1/photos/%s/files/%s/primary", uuid, fileuuid)
return resp.Error
}
// POST /api/v1/photos/:uid/label
//
// Parameters:
// uid: string PhotoUID as returned by the API
func (v1 *V1Client) AddPhotoLabel(uuid string, name string) error {
payload := struct {
Name string `json:"Name"`
Priority int `json:"Priority"`
}{
Name: name,
Priority: 10,
}
resp := v1.POST(payload, "/api/v1/photos/%s/label", uuid)
return resp.Error
}

5
go.mod
View File

@ -2,4 +2,7 @@ module github.com/astravexton/photoprism-client-go
go 1.15
require github.com/astravexton/logger v0.2.1 // indirect
require (
github.com/astravexton/logger v0.2.1
github.com/kris-nova/logger v0.2.1
)

2
go.sum
View File

@ -1,2 +1,4 @@
github.com/astravexton/logger v0.2.1 h1:nYxhV6oCHIJzUzaPhawbAc51EEvJowIViVsB5EbdeJQ=
github.com/astravexton/logger v0.2.1/go.mod h1:6uxVhLlWlvZn48W8F52dsMXt4yztlrInpRhdWiJ9RXc=
github.com/kris-nova/logger v0.2.1 h1:hbZusgXXXTSd0rNAMBBe/8lhjxXkqWs0+nzjwewCI+E=
github.com/kris-nova/logger v0.2.1/go.mod h1:++9BgZujZd4v0ZTZCb5iPsaomXdZWyxotIAh1IiDm44=