photoprism-client-go/api/v1
Astra 8545e098c1 Code cleanup 2023-01-18 00:48:30 +00:00
..
README.md Adding docs and ready for 1.0.0 2021-02-11 18:04:53 -08:00
album.go Adding docs and ready for 1.0.0 2021-02-11 18:04:53 -08:00
client.go Fixing found bug in UpdatePhoto UUID->photoUID 2021-02-13 13:20:23 -08:00
index.go Adding docs and ready for 1.0.0 2021-02-11 18:04:53 -08:00
photo.go Code cleanup 2023-01-18 00:48:30 +00:00
types.go Code cleanup 2023-01-18 00:48:30 +00:00

README.md

V1 SDK

This is the main SDK code. Here be dragons.

The V1 Client ships with the following HTTP methods

  • GET
  • POST
  • PUT
  • DELETE

The client can also be chained using the following two chain methods.

JSON Marshal

To send a GET request to /api/v1/photos/:uuid and marshal the results on to a Photo struct

    uuid := "123"
    photo := Photo{
        UUID: uuid,
    }
    err := v1.GET("/api/v1/photos/%s", uuid).JSON(&object)
    // 
    fmt.Println(err)
    fmt.Println(photo)

String

Sometimes it is helpful to just see what the Photoprism API returns. The String() method implements the Go idiomatic String() and will return the body of the response for debugging.

To send a GET request to /api/v1/photos/:uuid and see the raw JSON output

    uuid := "123"
    fmt.Println(v1.GET("/api/v1/photos/%s", uuid).String())