Description
The KVStoreCollectionData
response from query_by_id
is a dict. However, this requires the user to convert the dict to a string before passing it back to any function that pushes data to the collection.
Any dict returned should be able to be returned directly to other functions that modify content in the KV store.
Adding something like the following would allow backward compatibility, while permitting more flexibility to deal with the object directly without having to coerce the returned data into a string before passing it back to the KV store.
:type data: ``string`` or ``dict``
...
if isinstance(data, dict):
data = json.dumps(data)
...
...
data = collection.data.query_by_id(id="kv_store_id")
data['key'] = 'value'
collection.data.update(id='kv_store_id', data=data) == {'_key': 'kv_store_id'}
# Instead of having the API user repeatedly call json.dumps()
# collection.data.update(id='kv_store_id', data=json.dumps(data)) == {'_key': 'kv_store_id'}
Another option would be creating a new function that wraps the insert and update functions. Either way, I expect the KVStoreCollectionData
POST functions would directly accept the data it returned from its GET functions.