User Story: "As a WME product team we want to have an original image and thumbnail to be added to the article response."
**Acceptance criteria**
# It expects that both thumbnail and original image are being fetched from for a particular article
# Also it expects that thumbnail and original image is added to the Kafka stream by structure data services (article-update and article-bulk)
# All related unit and integration tests pass successfully.
# For the product clients for all the services including On-demand, Reatlime Batch, Snapshots, Realtime Streaming the response have the following structure
```
{
"article" : {
"image": {
"contentUrl": "https://upload.wikimedia.org/wikipedia/commons/3/3e/Einstein_1921_by_F_Schmutzer_-_restoration.jpg",
"width": 2523,
"height": 3313,
"thumbnail": {
"contentUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3e/Einstein_1921_by_F_Schmutzer_-_restoration.jpg/300px-Einstein_1921_by_F_Schmutzer_-_restoration.jpg",
"width": 300,
"height": 394
}
}
}
}
```
To accomplish that we need to add several adjustments to our services and schema:
**ToDo**
- [x] Adjust JSON schema documentation by adding image representation for an article (It’s actually done during this investigation)
- [x] Adjust Avro Schema according to the JSON Schema (also done)
- [ ] Adjust WMF API client library so it can request images for an article.
According to the Wikimedia Actions API docs, both original image and thumbnail can be retrieved by adding a particular parameter to a request, specifically by adding pageimages parameter to the API request:
**props=pageimages**
In order to get both the original image and thumbnail, the request parameters should be extended with piprop parameter:
**piprop=thumbnail|original**
By default Action API returns a thumbnail scaled by default size (which differs from page to page). If we need a specific size of the thumbnail, it also can be achieved by adding a parameter to the API request:
**pithumbsize=500** (Value “500” corresponds to width of the thumbnail.)
According to this we can adjust our [[ https://gitlab.gluzdov.com/wikimedia-enterprise/general/wmf | WMF client library ]] so it fetches and returns bot original image and thumbnail. Also unit test should be adjusted.
//Note: We can add required props to [[ https://gitlab.gluzdov.com/wikimedia-enterprise/general/wmf/-/blob/main/wmf.go#L690 | GetPages method ]] or add new method. //
- [ ] Adjust structured data service so that it adds both thumbnail and original image to a Kafka message. In order to do that we need to adjust Aggregate package by adding GetPageImages method and use it in article-update and article-bulk handlers. Also unit test should be adjusted to handle the new functionality.