# storageApi

### setStorage

Stores a value or a list of values. This method supports the following signatures:

* Single item mode

  ```
  setStorage(name:String, value:*, entityId:String): Promise<*,Error>
  ```
* Batch mode

  ```
  setStorage(batch:Array<{name:String, value:*}>, entityId:String): Promise<Array<{name:String, value:*}>,Error>
  ```

### setAppStorage

Stores a value or a set of values attaching every value to the application. This method supports the following signatures:

* Single item mode

  ```
  setAppStorage(name:String, value:*): Promise<*,Error>
  ```
* Batch mode

  ```
  setAppStorage(batch:Array<{name:String, value:*}>): Promise<Array<{name:String, value:*}>,Error>
  ```

### setEntityStorage

Stores a value or a set of values attaching every value to the application's context entity. This method supports the following signatures:

* Single item mode

  ```
  setEntityStorage(name:String, value:*): Promise<*,Error>
  ```
* Batch mode

  ```
  setEntityStorage(batch:Array<{name:String, value:*}>): Promise<Array<{name:String, value:*}>,Error>
  ```

### getStorage

`getStorage(name, entityId, defaultValue = null)`

Retrieves a generic storage item or a list

### getAppStorage

`getAppStorage(name, defaultValue = null)`

Retrieves a storage item attached to the application

### getEntityStorage

`getEntityStorage(name, defaultValue = null)`

Retrieves a storage item attached to the application's context entity
