mysociety / popit-api

DEPRECATED - Development on PopIt has stopped and it is no longer being maintained
https://goo.gl/Vvej4Q
Other
17 stars 3 forks source link

Allow one to determine the position of an uploaded image in 'images' #134

Closed mhl closed 9 years ago

mhl commented 9 years ago

The behaviour when you upload an image via the PopIt API at the moment is that it is appended to the 'images' array. It would be helpful to be able to instead say that the image should be inserted at the front of the 'images' array, so that it's the "primary" image for that person (i.e. the one that is used for the 'image' property)

This commit introduces a special parameter called 'index' when POSTing a new image, which can be either set to 'first', 'last', '0', '1', '2', '3', etc. to insert the image at the start of 'images', the end of 'images' or at a specific index (where 0 is the first place in the array).

chrismytton commented 9 years ago

Looks good to me! :rocket: