From 6436478402504c332fb545c93770930baeeed9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kris=20N=C3=B3va?= Date: Thu, 11 Feb 2021 15:32:03 -0800 Subject: [PATCH] Adding initial album feature work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kris NĂ³va --- api/v1/album.go | 82 ++++++++++++++++++ examples/album.go | 27 +++--- examples/getalbum.go | 44 ++++++++++ .../storage/albums/album/aqoe01hgxpo1hjih.yml | 9 ++ .../storage/albums/album/aqoe0941aw0wz0rj.yml | 9 ++ .../storage/albums/album/aqoe0j0nog2wtd98.yml | 9 ++ .../storage/albums/album/aqoe0o1v8rjprqy6.yml | 10 +++ .../storage/albums/album/aqoe0xu1149t43i3.yml | 9 ++ .../storage/albums/album/aqoe0zl3h1wak08f.yml | 10 +++ .../storage/albums/album/aqoe1231tb94a48k.yml | 9 ++ .../storage/albums/album/aqoe1981fbhzaou2.yml | 8 ++ .../storage/albums/album/aqoe1bw1ywyawhlb.yml | 8 ++ .../storage/albums/album/aqoe1cs1rrfaer9d.yml | 9 ++ .../photoprism/storage/cache/sessions.json | 80 +++++++++++++++++ sample-app/photoprism/storage/index.db | Bin 425984 -> 425984 bytes .../2021/02/20210204_031706_5B740007.yml | 6 +- test/album_test.go | 34 ++++++++ test/main_test.go | 1 + 18 files changed, 346 insertions(+), 18 deletions(-) create mode 100644 examples/getalbum.go create mode 100755 sample-app/photoprism/storage/albums/album/aqoe01hgxpo1hjih.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe0941aw0wz0rj.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe0j0nog2wtd98.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe0o1v8rjprqy6.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe0xu1149t43i3.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe0zl3h1wak08f.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe1231tb94a48k.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe1981fbhzaou2.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe1bw1ywyawhlb.yml create mode 100755 sample-app/photoprism/storage/albums/album/aqoe1cs1rrfaer9d.yml diff --git a/api/v1/album.go b/api/v1/album.go index d418ff9..3cf77ed 100644 --- a/api/v1/album.go +++ b/api/v1/album.go @@ -1,5 +1,7 @@ package api +import "fmt" + type AlbumOptions struct { ParamType string Q string @@ -57,3 +59,83 @@ func (v1 *V1Client) GetAlbum(uuid string) (Album, error) { err := v1.GET("/api/v1/albums/%s", uuid).JSON(&album) return album, err } + +// CreateAlbum is used to create a new Album. +// +// CreateAlbum will default to sane values +// such that an empty Album{} object will still +// create a new album. +// +//POST /api/v1/albums +func (v1 *V1Client) CreateAlbum(object Album) (Album, error) { + err := v1.POST(&object, "/api/v1/albums").JSON(&object) + return object, err +} + +// PUT /api/v1/albums/:uid +func (v1 *V1Client) UpdateAlbum(object Album) (Album, error) { + if object.AlbumUID == "" { + return object, fmt.Errorf("missing album.AlbumUID in album") + } + err := v1.PUT(&object, "/api/v1/albums/%s", object.AlbumUID).JSON(&object) + return object, err +} + +// POST /api/v1/batch/albums/delete +func (v1 *V1Client) DeleteAlbums(uuids []string) error { + payload := struct { + Albums []string `json:"albums"` + }{ + Albums: uuids, + } + resp := v1.POST(payload, "/api/v1/batch/albums/delete") + return resp.Error +} + +// POST /api/v1/albums/:uid/like +// +// Parameters: +// uid: string Album UID +func (v1 *V1Client) LikeAlbum(uuid string) error { + resp := v1.POST(nil, "/api/v1/albums/%s/like", uuid) + return resp.Error +} + +// DELETE /api/v1/albums/:uid/like +// +// Parameters: +// uid: string Album UID +func (v1 *V1Client) DislikeAlbum(uuid string) error { + resp := v1.DELETE(nil, "/api/v1/albums/%s/like", uuid) + return resp.Error +} + +// POST /api/v1/albums/:uid/clone +func (v1 *V1Client) CloneAlbums(object Album) (Album, error) { + if object.AlbumUID == "" { + return object, fmt.Errorf("missing album.AlbumUID in album") + } + newAlbum := Album{} + err := v1.POST(&object, "/api/v1/albums/%s/clone", object.AlbumUID).JSON(&newAlbum) + return newAlbum, err +} + +// POST /api/v1/albums/:uid/photos +func (v1 *V1Client) AddPhotosToAlbum(albumUUID string, objects []Photo) error { + resp := v1.POST(&objects, "/api/v1/albums/%s/photos", albumUUID) + return resp.Error +} + +// DELETE /api/v1/albums/:uid/photos +func (v1 *V1Client) DeletePhotosFromAlbum(albumUUID string, objects []Photo) error { + resp := v1.DELETE(&objects, "/api/v1/albums/%s/photos", albumUUID) + return resp.Error +} + +// GET /api/v1/albums/:uid/dl +func (v1 *V1Client) GetAlbumDownload(uuid string) ([]byte, error) { + // NOTE: Even though this method is singular GetAlbum + // if will call the "albums" plural endpoint. + resp := v1.GET("/api/v1/albums/%s", uuid) + return resp.Body, resp.Error +} diff --git a/examples/album.go b/examples/album.go index 63cd4bd..6213617 100644 --- a/examples/album.go +++ b/examples/album.go @@ -1,9 +1,8 @@ package main import ( - "fmt" - photoprism "github.com/kris-nova/client-go" + "github.com/kris-nova/client-go/api/v1" "github.com/kris-nova/logger" ) @@ -18,7 +17,6 @@ func main() { logger.Level = 4 // // --- - uuid := "aqnzih81icziiyae" client := photoprism.New("http://localhost:8080") err := client.Auth(photoprism.NewClientAuthLogin("admin", "missy")) @@ -27,18 +25,17 @@ func main() { } logger.Always("Logged in...") - album, err := client.V1().GetAlbum(uuid) - if err != nil { - halt(3, "Error getting album %s", uuid) - } - fmt.Println(album) - - albums, err := client.V1().GetAlbums(nil) - if err != nil { - halt(2, "Error listing albums: %v", err) - } - for _, album := range albums { - fmt.Println(album) + album := api.Album{ + AlbumTitle: "NovaAlbum", } + newAlbum, err := client.V1().CreateAlbum(album) + if err != nil { + halt(2, "Error creating album: %v", err) + } + + err = client.V1().DeleteAlbums([]string{newAlbum.AlbumUID}) + if err != nil { + halt(1, "Error deleting album: %v", err) + } } diff --git a/examples/getalbum.go b/examples/getalbum.go new file mode 100644 index 0000000..63cd4bd --- /dev/null +++ b/examples/getalbum.go @@ -0,0 +1,44 @@ +package main + +import ( + "fmt" + + photoprism "github.com/kris-nova/client-go" + "github.com/kris-nova/logger" +) + +func main() { + // --- + // Log Level 4 (Most) + // Log Level 3 + // Log Level 2 + // Log Level 1 + // Log Level 0 (Least) + // + logger.Level = 4 + // + // --- + uuid := "aqnzih81icziiyae" + + client := photoprism.New("http://localhost:8080") + err := client.Auth(photoprism.NewClientAuthLogin("admin", "missy")) + if err != nil { + halt(4, "Error logging into API: %v", err) + } + logger.Always("Logged in...") + + album, err := client.V1().GetAlbum(uuid) + if err != nil { + halt(3, "Error getting album %s", uuid) + } + fmt.Println(album) + + albums, err := client.V1().GetAlbums(nil) + if err != nil { + halt(2, "Error listing albums: %v", err) + } + for _, album := range albums { + fmt.Println(album) + } + +} diff --git a/sample-app/photoprism/storage/albums/album/aqoe01hgxpo1hjih.yml b/sample-app/photoprism/storage/albums/album/aqoe01hgxpo1hjih.yml new file mode 100755 index 0000000..2c2cc87 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe01hgxpo1hjih.yml @@ -0,0 +1,9 @@ +UID: aqoe01hgxpo1hjih +Slug: novaalbum +Type: album +Title: NovaAlbum +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:03:18Z +UpdatedAt: 2021-02-11T23:03:18Z +DeletedAt: 2021-02-11T23:14:45.771988424Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe0941aw0wz0rj.yml b/sample-app/photoprism/storage/albums/album/aqoe0941aw0wz0rj.yml new file mode 100755 index 0000000..ef9600d --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe0941aw0wz0rj.yml @@ -0,0 +1,9 @@ +UID: aqoe0941aw0wz0rj +Slug: testalbum +Type: album +Title: TestAlbum +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:07:53Z +UpdatedAt: 2021-02-11T23:07:53Z +DeletedAt: 2021-02-11T23:14:36.400063828Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe0j0nog2wtd98.yml b/sample-app/photoprism/storage/albums/album/aqoe0j0nog2wtd98.yml new file mode 100755 index 0000000..a904798 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe0j0nog2wtd98.yml @@ -0,0 +1,9 @@ +UID: aqoe0j0nog2wtd98 +Slug: february-2021 +Type: album +Title: February 2021 +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:13:49Z +UpdatedAt: 2021-02-11T23:13:49Z +DeletedAt: 2021-02-11T23:14:30.637709439Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe0o1v8rjprqy6.yml b/sample-app/photoprism/storage/albums/album/aqoe0o1v8rjprqy6.yml new file mode 100755 index 0000000..75d8bd8 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe0o1v8rjprqy6.yml @@ -0,0 +1,10 @@ +UID: aqoe0o1v8rjprqy6 +Slug: testalbum +Type: album +Title: TestAlbum +Description: An updated album description +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:16:49Z +UpdatedAt: 2021-02-11T23:16:49.091245891Z +DeletedAt: 2021-02-11T23:18:32.10184988Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe0xu1149t43i3.yml b/sample-app/photoprism/storage/albums/album/aqoe0xu1149t43i3.yml new file mode 100755 index 0000000..87f6065 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe0xu1149t43i3.yml @@ -0,0 +1,9 @@ +UID: aqoe0xu1149t43i3 +Slug: testalbum +Type: album +Title: TestAlbum +Description: An updated album description +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:22:42Z +UpdatedAt: 2021-02-11T23:22:42.31692892Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe0zl3h1wak08f.yml b/sample-app/photoprism/storage/albums/album/aqoe0zl3h1wak08f.yml new file mode 100755 index 0000000..0de539d --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe0zl3h1wak08f.yml @@ -0,0 +1,10 @@ +UID: aqoe0zl3h1wak08f +Slug: testalbum +Type: album +Title: TestAlbum +Description: An updated album description +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:23:46Z +UpdatedAt: 2021-02-11T23:23:45.864716162Z +DeletedAt: 2021-02-11T23:24:31.729202695Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe1231tb94a48k.yml b/sample-app/photoprism/storage/albums/album/aqoe1231tb94a48k.yml new file mode 100755 index 0000000..b0d2460 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe1231tb94a48k.yml @@ -0,0 +1,9 @@ +UID: aqoe1231tb94a48k +Slug: testalbum +Type: album +Title: TestAlbum +Description: An updated album description +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:25:16Z +UpdatedAt: 2021-02-11T23:25:15.61908592Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe1981fbhzaou2.yml b/sample-app/photoprism/storage/albums/album/aqoe1981fbhzaou2.yml new file mode 100755 index 0000000..47e1787 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe1981fbhzaou2.yml @@ -0,0 +1,8 @@ +UID: aqoe1981fbhzaou2 +Slug: novaalbum +Type: album +Title: NovaAlbum +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:29:33Z +UpdatedAt: 2021-02-11T23:29:33Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe1bw1ywyawhlb.yml b/sample-app/photoprism/storage/albums/album/aqoe1bw1ywyawhlb.yml new file mode 100755 index 0000000..5481caa --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe1bw1ywyawhlb.yml @@ -0,0 +1,8 @@ +UID: aqoe1bw1ywyawhlb +Slug: novaalbum +Type: album +Title: NovaAlbum +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:31:08Z +UpdatedAt: 2021-02-11T23:31:08Z diff --git a/sample-app/photoprism/storage/albums/album/aqoe1cs1rrfaer9d.yml b/sample-app/photoprism/storage/albums/album/aqoe1cs1rrfaer9d.yml new file mode 100755 index 0000000..26701d6 --- /dev/null +++ b/sample-app/photoprism/storage/albums/album/aqoe1cs1rrfaer9d.yml @@ -0,0 +1,9 @@ +UID: aqoe1cs1rrfaer9d +Slug: testalbum +Type: album +Title: TestAlbum +Description: An updated album description +Order: oldest +Country: zz +CreatedAt: 2021-02-11T23:31:41Z +UpdatedAt: 2021-02-11T23:31:40.791556222Z diff --git a/sample-app/photoprism/storage/cache/sessions.json b/sample-app/photoprism/storage/cache/sessions.json index 8e19330..942daf7 100644 --- a/sample-app/photoprism/storage/cache/sessions.json +++ b/sample-app/photoprism/storage/cache/sessions.json @@ -24,6 +24,11 @@ "tokens": null, "expiration": 1613523028656083744 }, + "0bab87ab1e73344a73e4693465cfa7cd20bc3a448c11db72": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613691100770470924 + }, "0bc03c7776136e860865c7cd2c30d6678e896805d0e0bba8": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -64,6 +69,11 @@ "tokens": null, "expiration": 1613522078076464014 }, + "1ba9c019aaf278b159770a919acc5d1583948c1a8de9a5b3": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690715601777218 + }, "1c2319c0a31690d8c0d9c5bb857ce4b94f7bef2e3289ae4a": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -204,6 +214,11 @@ "tokens": null, "expiration": 1613512362197250367 }, + "542cf5000fd4adbc7d1b7d6f2919b3d73afcb4620784adb0": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690210163840938 + }, "54f0731493c76d77c00d186f56ee6adc78e27bebd6b92ff3": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -239,6 +254,11 @@ "tokens": null, "expiration": 1613512018478271866 }, + "69a5ba6601a0b258d6437ec792376eb0401c31b03b786629": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613689397688309140 + }, "6b00829c3aa13681213f90fd643a209949649ae88f4eb42f": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -274,6 +294,11 @@ "tokens": null, "expiration": 1613513949594487106 }, + "7f1f06b8c49a3a01e73aebdca48bfdeeaf88ef787d2aee26": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690716677589751 + }, "81000ef1dad0e84ef593d3838fb4ccb28a409d60cfaa7ef7": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -299,6 +324,11 @@ "tokens": null, "expiration": 1613517781243806242 }, + "86acf10dff5dfab564a21f7b32c9ec566b4bd36e47eef949": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690562297926322 + }, "86e47c8475bbab147dc714ca6ae10b2ea64471d20a74e248": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -329,6 +359,11 @@ "tokens": null, "expiration": 1613682894304104797 }, + "8e476122d25b0acc53f7c39d66c41dbd471cb4744f0a649d": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690626957554055 + }, "910c4f6a3943e402e338511b235f43f8728d6f7e18b2c1b3": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -354,6 +389,11 @@ "tokens": null, "expiration": 1613500880573233477 }, + "9220029905f142122fd03387a4d05f8a87f4dd9ac232f2b9": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690625840353698 + }, "9223b8bc874aa1b1242ecbfc768221a8cd9e888c305700d2": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -439,16 +479,31 @@ "tokens": null, "expiration": 1613675188854967428 }, + "b7effc2db3f4e76c1c89fcd722fafaee3677a78cf4a8a38f": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613691101882965054 + }, "c053cc843cd5a58b6e7e4dfb0b896180734df58c6cf6ca88": { "user": "uqnzie01i1nypnt9", "tokens": null, "expiration": 1613528519484379600 }, + "c27771d21e4c9ff2138ce837aa3ec1c17d878ee4ffb1c58d": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613689672561735257 + }, "c3440286c8cf0b619ec0a5883a836115de84752c519f625c": { "user": "uqnzie01i1nypnt9", "tokens": null, "expiration": 1613525841223849602 }, + "c441f23ff44d11d2f081ca17a69442b088f239589c22ee26": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690209070329699 + }, "c558cccdd25917056e8b7b72a2a3e5f40215d707a6fac1aa": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -469,6 +524,11 @@ "tokens": null, "expiration": 1613513847101926534 }, + "cd761cc3f15466f29eb789f5909bf26757d15661710e778c": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690028972954078 + }, "cf5e23f28813fe367d3e1a5de1fc066b76988cae3d14343d": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -479,6 +539,16 @@ "tokens": null, "expiration": 1613675187685124347 }, + "d5cc9946cfa1d25fe55d42bf32e95d3690c856eaf81b549e": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690972875693176 + }, + "d67b4bf0a826d445959290e5de933409b06a6f593b0c665c": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613691068036487540 + }, "d86c17fdb63eb3ef0665cb91fe3b29e8d823dd04eed50bac": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -489,6 +559,11 @@ "tokens": null, "expiration": 1613514267386702538 }, + "da47e471e7e0a996446fc88475ebe001baf4fa0d727a83be": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613690563421338386 + }, "dcd50767e8b3450a095c535963f521b3b52457d4bdcdb7c6": { "user": "uqnzie01i1nypnt9", "tokens": null, @@ -499,6 +574,11 @@ "tokens": null, "expiration": 1613511459136720858 }, + "e435fcbb9a19b7f4108d793705366ef9150d368b318787e4": { + "user": "uqnzie01i1nypnt9", + "tokens": null, + "expiration": 1613689673738164054 + }, "e8f29a4ea45aff82722b11d21754fc4adcb63d2671545e0c": { "user": "uqnzie01i1nypnt9", "tokens": null, diff --git a/sample-app/photoprism/storage/index.db b/sample-app/photoprism/storage/index.db index 776fabe656ce5aaae95b304f256584296c894b2a..1bb07f4f4e58917f8bc5cc60b9f6e2ccea5aa334 100644 GIT binary patch delta 3261 zcmcImZ){Ul6n}4hUH{%58_{KxY$Y*FM_TTE|6dI*AexXYvOjzf6VaA+bYojbX&I|A zZw&@MDmJEkF#h`{#u>8@Lx%~d@IevONEAb4L_bL4kQfPHO!VIV+w1zO7_doC&bjBj zdw=KLbIv`pvmLXu9WQsZw2-4~w@~`QbBXOdnm@b!k^XgPkVCG14t52;3G|_N{cis| zzAfH2Jl}g1_X&5KtA9RtPsC;Bx1tU%j8GS9>p}=Uj!-)ay4kOHXehQXl_0zKlXQ9{ zmPi}JnZ*7~Y&@QwD3Kjh+RUWQlcDU?a4eG;4wV$4;l%#k>CvgoXlgPwPK8V^Ct{I= zu^1*KBuY_OidQhsp3iNyU;QO~GQl36OtKM6jaESkq;r{O$8T8-Qjh(!E?M(uPh( z;>lbrl@(VI-UdL?h)R+jK#L+D@>-9t-gBH?^g#J|Q6ibRA;)BW?_IlSQHd7Gb^czH zUOMH85>bhPb;YRMY<{c94%SNg;oP{CB-63ISRc6qRAzmaQ8cn@8!@U-BDyMTL?xMYhK zE2I2lu4W*I23Q8-6gi-$$EMQzX4Jcek*HDGFztd}(nPR9L|M^|Qa@N->qL)AVuWBq z%Sf*jVZPI8b)&J=u_2S#G@j1k^jO6Wb9K+MFLkU%728T`svtBQ)QF5RRwZ4mB3$2E zLfDPkx+y&RE9{!{21|VikKxJG9&tJ|Z0LoVxs7JIBNCc;l}1s2#myD;WE@c?O{4xw zm2WwY+ZnEPb9(Sf7c3QdV`$8Vc5WYKgarrU z5hH#^e2jP*@i5|M#KlM}BhKRT1)+^@+sDCmxCxhG4$eaoo`zHKCcFYK!U5=`+xCEo z99?{^Y!H)baq!nkzB)^9o#d&L+;x&G=;-E067h64mYxZ-JZZJ)gV_lu6KjVGh07Nn zqR1B*@@w!jT!A0pB76m3z*#sACt(3@Qsl3K$Q-@xfG}gBaP7(i|6i;RbFc*8(Kw%> zDCglgyamVLB{)pue~ls@hQiWc?m^^s(ou!a<@{B~S7p3a##3e7RmN3iTC0q+$_RAZ z2Rl*VoHc{i(u+O@Q?L!z1^x(}qsJc)nB9&czP?V`NW%t~x~T-&+F^b5Y(Vpn<9&_B zwr`DRy~7+>b-G=jbT#g0TQ`EOU1L{suGl?Q9pqU1YiL5WZa7v@9IGXccQDf8aBvaGjM}O_k6%y;|TMsXHQgHv|QfiIo|plx@xAD{@q$zw7fXZ+M=Z)7EeFx=vr9n;@|!ihQTg0<5uFsC=&6Ag2_aaMDsxX`4Upms oCxwt>Qwu2``%u_WR2GFti})kqq7b;m7ms)rg$2)|^VVm71E;Si)Bpeg delta 371 zcmZo@kZNdmF@Rjb0CmM72L3nv*ZB_tU9p9K`Ug2iw(Te68F!r(G_o?Zv@$l=voJI;G&C_Z zH*BB$mJx`VwoiV`>{!4Kk++=uaJ}gC53wu?Pz@G(76xX9Muw(FCfgO`SRMrO^W9`% z;XKU5&B}S0_aM)l&4L0goGg4d8S|$f-^rrA{qRl}Cq|ZL5k{kS&fP5AId`*uKLP+_ CJahm6 diff --git a/sample-app/photoprism/storage/sidecar/2021/02/20210204_031706_5B740007.yml b/sample-app/photoprism/storage/sidecar/2021/02/20210204_031706_5B740007.yml index ec2f150..cbb3dfd 100755 --- a/sample-app/photoprism/storage/sidecar/2021/02/20210204_031706_5B740007.yml +++ b/sample-app/photoprism/storage/sidecar/2021/02/20210204_031706_5B740007.yml @@ -3,7 +3,7 @@ UID: pqnzigq351j2fqgn Type: image Title: A really great photo! TitleSrc: manual -Description: 'Sample App Description: 2021-02-11 14:19:37.7961079 -0800 PST m=+6.239338909' +Description: 'Sample App Description: 2021-02-11 15:31:40.812509789 -0800 PST m=+1.281183587' DescriptionSrc: manual OriginalName: IMG_3044 Year: -1 @@ -13,5 +13,5 @@ Details: Keywords: green, tambourine KeywordsSrc: manual CreatedAt: 2021-02-04T03:17:14.613092062Z -UpdatedAt: 2021-02-11T22:19:37.804340087Z -EditedAt: 2021-02-11T22:19:38Z +UpdatedAt: 2021-02-11T23:31:40.821110735Z +EditedAt: 2021-02-11T23:31:41Z diff --git a/test/album_test.go b/test/album_test.go index d3b7f81..0350059 100644 --- a/test/album_test.go +++ b/test/album_test.go @@ -65,3 +65,37 @@ func TestSadGetAlbums(t *testing.T) { t.FailNow() } } + +// TestHappyCreateUpdateDeleteAlbum +func TestHappyCreateUpdateDeleteAlbum(t *testing.T) { + album := api.Album{ + AlbumTitle: WellKnownAlbumTitle, + } + + newAlbum, err := Client.V1().CreateAlbum(album) + if err != nil { + t.Errorf("expected success creating album: %v", err) + t.FailNow() + } + + newAlbum.AlbumDescription = "An updated album description" + newAlbum, err = Client.V1().UpdateAlbum(newAlbum) + if err != nil { + t.Errorf("unable to update test album: %v", err) + // Note: We do NOT FailNow() here because we want to clean up + } + + err = Client.V1().DeleteAlbums([]string{newAlbum.AlbumUID}) + if err != nil { + t.Errorf("expected delete album %s, album not deleted: %v", newAlbum.AlbumUID, err) + t.FailNow() + } + +} + +// LikeAlbum +// DislikeAlbum +// CloneAlbums +// AddPhotosToAlbum +// DeletePhotosFromAlbum +// GetAlbumDownload diff --git a/test/main_test.go b/test/main_test.go index 6bcc7b4..7c1ca30 100644 --- a/test/main_test.go +++ b/test/main_test.go @@ -22,6 +22,7 @@ const ( UnknownAlbumID = "1234567890" WellKnownSampleAppConnectionString = "http://localhost:8080" UnknownCategory = "Furries" + WellKnownAlbumTitle = "TestAlbum" ) // Client is a pre-authenticated client that can be used