2021-01-31 07:41:23 +01:00
|
|
|
package api
|
|
|
|
|
|
|
|
|
2021-01-31 09:08:52 +01:00
|
|
|
|
|
|
|
// GET /api/v1/photos/:uuid
|
2021-01-31 07:41:23 +01:00
|
|
|
//
|
|
|
|
// Parameters:
|
2021-01-31 09:08:52 +01:00
|
|
|
// uuid: string PhotoUID as returned by the API
|
2021-02-10 01:00:02 +01:00
|
|
|
func (v1 *V1Client) GetPhoto(uuid string) (Photo, error) {
|
2021-02-09 23:45:36 +01:00
|
|
|
object := Photo{
|
2021-01-31 09:08:52 +01:00
|
|
|
UUID: uuid,
|
|
|
|
}
|
2021-02-09 23:45:36 +01:00
|
|
|
err := v1.GET("/api/v1/photos/%s", uuid).JSON(&object)
|
2021-02-10 01:00:02 +01:00
|
|
|
return object, err
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// PUT /api/v1/photos/:uid
|
2021-02-10 03:25:46 +01:00
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// uuid: string PhotoUUID as returned by the API
|
2021-02-10 01:00:02 +01:00
|
|
|
func (v1 *V1Client) UpdatePhoto(object Photo) (Photo, error) {
|
|
|
|
err := v1.PUT(&object, "/api/v1/photos/%s", object.UUID).JSON(&object)
|
|
|
|
return object, err
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
2021-01-31 09:08:52 +01:00
|
|
|
// GET /api/v1/photos/:uuid/dl
|
2021-01-31 07:41:23 +01:00
|
|
|
//
|
|
|
|
// Parameters:
|
2021-01-31 09:08:52 +01:00
|
|
|
// uuid: string PhotoUUID as returned by the API
|
2021-02-10 03:25:46 +01:00
|
|
|
func (v1 *V1Client) GetPhotoDownload(uuid string) ([]byte, error) {
|
|
|
|
resp := v1.GET("/api/v1/photos/%s/dl?t=%s", uuid, v1.downloadToken)
|
|
|
|
return resp.Body, resp.Error
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
2021-01-31 09:08:52 +01:00
|
|
|
// GET /api/v1/photos/:uuid/yaml
|
2021-01-31 07:41:23 +01:00
|
|
|
//
|
|
|
|
// Parameters:
|
2021-01-31 09:08:52 +01:00
|
|
|
// uuid: string PhotoUUID as returned by the API
|
2021-02-10 03:25:46 +01:00
|
|
|
func (v1 *V1Client) GetPhotoYaml(uuid string) ([]byte, error) {
|
|
|
|
resp := v1.GET("/api/v1/photos/%s/yaml", uuid)
|
|
|
|
return resp.Body, resp.Error
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
2021-01-31 09:08:52 +01:00
|
|
|
// POST /api/v1/photos/:uuid/approve
|
2021-01-31 07:41:23 +01:00
|
|
|
//
|
|
|
|
// Parameters:
|
2021-01-31 09:08:52 +01:00
|
|
|
// uuid: string PhotoUUID as returned by the API
|
2021-02-10 03:25:46 +01:00
|
|
|
func (v1 *V1Client) ApprovePhoto(uuid string) error {
|
|
|
|
resp := v1.POST(nil, "/api/v1/photos/%s/approve", uuid)
|
|
|
|
return resp.Error
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// POST /api/v1/photos/:uid/like
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// uid: string PhotoUID as returned by the API
|
2021-02-04 06:01:21 +01:00
|
|
|
func (v1 *V1Client) LikePhoto(uuid string) error {
|
2021-02-10 03:25:46 +01:00
|
|
|
resp := v1.POST(nil, "/api/v1/photos/%s/like", uuid)
|
|
|
|
return resp.Error
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
2021-01-31 09:08:52 +01:00
|
|
|
// DELETE /api/v1/photos/:uuid/like
|
2021-01-31 07:41:23 +01:00
|
|
|
//
|
|
|
|
// Parameters:
|
2021-01-31 09:08:52 +01:00
|
|
|
// uuid: string PhotoUUID as returned by the API
|
2021-02-04 06:01:21 +01:00
|
|
|
func (v1 *V1Client) DislikePhoto(uuid string) error {
|
2021-02-10 03:25:46 +01:00
|
|
|
resp := v1.DELETE(nil, "/api/v1/photos/%s/approve", uuid)
|
|
|
|
return resp.Error
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// POST /api/v1/photos/:uid/files/:file_uid/primary
|
|
|
|
//
|
|
|
|
// Parameters:
|
|
|
|
// uid: string PhotoUID as returned by the API
|
|
|
|
// file_uid: string File UID as returned by the API
|
2021-02-04 06:01:21 +01:00
|
|
|
func (v1 *V1Client) PhotoPrimary(uuid, fileuuid string) error {
|
2021-02-10 03:25:46 +01:00
|
|
|
resp := v1.POST(nil, "/api/v1/photos/%s/files/%s/primary", uuid, fileuuid)
|
|
|
|
return resp.Error
|
2021-01-31 07:41:23 +01:00
|
|
|
}
|