@Anomie has reworked ApiResult in https://gerrit.wikimedia.org/r/#/c/182858/ to make things a bit more logical. As part of this, the following changes would need to be made in the various Wikibase extensions:
- [easy] ApiResult::setElement() is replaced by ApiResult::setValue().
- [easy] ApiResult::setIndexedTagName_internal() is replaced by ApiResult::defineIndexedTagName().
- [easy] ApiResult::setIndexedTagName_recursive() is replaced by ApiResult::setIndexedTagNameOnSubarrays().
- [easy] Calls to ApiResult::setContent() should be replaced with ApiResult::setContentValue().
- [could get tricky] Calls to ApiResult::getData() should be replaced with ApiResult::getResultData(), possibly with appropriate calls to ApiResult::transformForBC() and ApiResult::removeMetadata()
- [could get tricky] Calls to ApiBase::getResultData() should be replaced with ->getResult()->getResultData(), with possible additional changes as above.
- [could be hard] Calls to ApiResult::getIsRawMode() and ApiResult::setRawMode() need to be removed.
The first four are things @Anomie could probably do with a little help from someone to make sure he can find all of the right places to make the changes. The last three will probably need someone more knowledgeable about Wikidata/Wikibase to implement the changes.
There may also be opportunity to do additional improvements to the output format when users request non-backwards-compatible format, see https://gerrit.wikimedia.org/r/#/c/191103/ for examples in core.