Skip to content

Commit

Permalink
Merge pull request #1379 from itsdax/master
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Aug 28, 2023
2 parents e295c7f + 22d143a commit 87e330f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .changelog/1379.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
images: Fix issue parsing Image Details from API due to incorrect struct json field
```

```release-note:breaking-change
images: Renamed Image struct "Metadata" field to "Meta"
```
2 changes: 1 addition & 1 deletion images.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
type Image struct {
ID string `json:"id"`
Filename string `json:"filename"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
RequireSignedURLs bool `json:"requireSignedURLs"`
Variants []string `json:"variants"`
Uploaded time.Time `json:"uploaded"`
Expand Down
12 changes: 6 additions & 6 deletions images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func timeMustParse(layout, value string) time.Time {
var expectedImageStruct = Image{
ID: "ZxR0pLaXRldlBtaFhhO2FiZGVnaA",
Filename: "avatar.png",
Metadata: map[string]interface{}{
Meta: map[string]interface{}{
"meta": "metaID",
},
RequireSignedURLs: true,
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestUploadImage(t *testing.T) {
"result": {
"id": "ZxR0pLaXRldlBtaFhhO2FiZGVnaA",
"filename": "avatar.png",
"metadata": {
"meta": {
"meta": "metaID"
},
"requireSignedURLs": true,
Expand Down Expand Up @@ -121,7 +121,7 @@ func TestUploadImageByUrl(t *testing.T) {
"result": {
"id": "ZxR0pLaXRldlBtaFhhO2FiZGVnaA",
"filename": "avatar.png",
"metadata": {
"meta": {
"meta": "metaID"
},
"requireSignedURLs": true,
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestUpdateImage(t *testing.T) {
"result": {
"id": "ZxR0pLaXRldlBtaFhhO2FiZGVnaA",
"filename": "avatar.png",
"metadata": {
"meta": {
"meta": "metaID"
},
"requireSignedURLs": true,
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestListImages(t *testing.T) {
{
"id": "ZxR0pLaXRldlBtaFhhO2FiZGVnaA",
"filename": "avatar.png",
"metadata": {
"meta": {
"meta": "metaID"
},
"requireSignedURLs": true,
Expand Down Expand Up @@ -378,7 +378,7 @@ func TestImageDetails(t *testing.T) {
"result": {
"id": "ZxR0pLaXRldlBtaFhhO2FiZGVnaA",
"filename": "avatar.png",
"metadata": {
"meta": {
"meta": "metaID"
},
"requireSignedURLs": true,
Expand Down

0 comments on commit 87e330f

Please sign in to comment.