Fixing found bug in UpdatePhoto UUID->photoUID
Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
parent
030b361d9e
commit
414bfb6aa1
17 changed files with 114 additions and 17 deletions
|
@ -8,8 +8,6 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/kris-nova/logger"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -49,8 +47,7 @@ type V1Response struct {
|
|||
func (r *V1Response) String() string {
|
||||
if r.Error != nil {
|
||||
// Handle errors from the HTTP request first
|
||||
logger.Warning("during HTTP request: %v", r.Error)
|
||||
return "{}"
|
||||
return fmt.Sprintf(`{\n"StatusCode":%d,\n"Body":"%s"}`, r.StatusCode, string(r.Body))
|
||||
}
|
||||
return string(r.Body)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ package api
|
|||
// uuid: string PhotoUID as returned by the API
|
||||
func (v1 *V1Client) GetPhoto(uuid string) (Photo, error) {
|
||||
photo := Photo{
|
||||
UUID: uuid,
|
||||
UUID: uuid,
|
||||
PhotoUID: uuid,
|
||||
}
|
||||
err := v1.GET("/api/v1/photos/%s", uuid).JSON(&photo)
|
||||
return photo, err
|
||||
|
@ -68,7 +69,7 @@ func (v1 *V1Client) GetPhotos(options *PhotoOptions) ([]Photo, error) {
|
|||
// Parameters:
|
||||
// uuid: string PhotoUUID as returned by the API
|
||||
func (v1 *V1Client) UpdatePhoto(photo Photo) (Photo, error) {
|
||||
err := v1.PUT(&photo, "/api/v1/photos/%s", photo.UUID).JSON(&photo)
|
||||
err := v1.PUT(&photo, "/api/v1/photos/%s", photo.PhotoUID).JSON(&photo)
|
||||
return photo, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue