Manage items stored in the app storage

Hi,

I’m developing a Custom UI app using Forge for Jira Cloud.
I need to store some data in the app’s storage using the Storage API.

From what I can see in the official docs, the Storage API exposes these options: set, get, delete and query.
Let’s say I created an array called items and inside this array, I have 5 items. If I want to add an additional item, I need to first get the existing value of the items key, add the 6th item, and then override the items entry with the new array.

Is there an easy way to do that? I would expect a update option that will simply append the new item(s) to the existing array.

Thanks,
Amit

@amityahav,

Unfortunately, our current hosted storage solution does not support an update operation as you described.

Other than a get and a set operation as you described, you could use the keys to define the structure of your data and leverage the search API when you don’t know what you’re looking for or the get API when you already know what you need.

Keys for user objects: user:${userId}
Keys for users’ favourite colours: user:${userId}-colour:${colour}

Take an example for storing a list of favourite colours of a user. Instead of just saving an array within the user object, you can have different objects for each colour and define specific keys to separate them.

Instead of this:

key: user:test
{
  "userId": "test",
  "colors": ["blue", "white", "black", "red"]
}

You could do this:

key: user:test
{
  "userId": "test"
}
key: user:test-colour:blue
{
  "userId": "test",
  "color": "blue"
}

Cheers,
Rodolfo

Thanks @amityahav for the feedback. I have added this feature request ticket to the Forge public Jira board to track: [FRGE-499] - Ecosystem Jira

Thank you, @SushantBista !