Class: StorageObject

StorageObject


new StorageObject(storageCollection, json)

Class that represents a storage object resource that can be used to store data.

Class that represents a storage object resource that can be used to store data.
Parameters:
Name Type Description
storageCollection StorageCollection
json Object
Source:

Members


contentLength :Number

The length of data content in bytes stored in the StorageObject.

The length of data content in bytes stored in the StorageObject.
Type:
  • Number
Source:

contentType :String

The media-type associated with the StorageObject.

The media-type associated with the StorageObject.
Type:
  • String
Source:

createdBy :String

The name of the user who created the StorageObject.

The name of the user who created the StorageObject.
Type:
  • String
Source:

createdOn :String

Server-generated timestamp when the StorageObject was created.

Server-generated timestamp when the StorageObject was created.
Type:
  • String
Source:

id :String

A service generated ID for the StorageObject.

A service generated ID for the StorageObject. The ID is unique in the StorageCollection.
Type:
  • String
Source:

modifiedBy :String

The name of the user who last updated the StorageObject.

The name of the user who last updated the StorageObject.
Type:
  • String
Source:

modifiedOn :String

Server-generated timestamp for when the StorageObject was last updated.

Server-generated timestamp for when the StorageObject was last updated.
Type:
  • String
Source:

name :String

A user-provided name for the StorageObject.

A user-provided name for the StorageObject. A StorageCollection may have multiple StorageObjects with the same name.
Type:
  • String
Source:

Methods


getDisplayName()

Returns a StorageObject's display name from an object.

Returns a StorageObject's display name from an object.
Source:
Returns:
String object's name decoded if encoded into the MobileBackend.

getPayload()

Returns the current StorageObject payload.

Returns the current StorageObject payload.
Source:
Returns:
Current Storage object payload.

getStorage()

Returns the current StorageObject.

Returns the current StorageObject.
Source:
Returns:
Current StorageObject.

getstorageCollection()

Returns the current StorageCollection.

Returns the current StorageCollection.
Source:
Returns:
Current StorageCollection.

loadPayload(payload, contentType)

Loads a StorageObject's contents from an object.

Loads a StorageObject's contents from an object.
Parameters:
Name Type Description
payload Object The object to load from.
contentType String The media-type to associate with the content.
Source:
Examples
payload: "Hello my name is Mia and this is a sample payload".
contentType: "application/json,text/plain".

readPayload(successCallback, errorCallback, objectType)

Returns the contents of the StorageObject.

Returns the contents of the StorageObject. May result in a download from the service if the contents were not previously downloaded.
Parameters:
Name Type Argument Description
successCallback StorageObject~readPayloadSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageObject~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
objectType responseType for the XMLHttpRequest Object.
Source:
Returns:
Type
Promise.<(StorageObject|NetworkResponse)>

setDisplayName(name)

Sets a StorageObject's display name from an object.

Sets a StorageObject's display name from an object.
Parameters:
Name Type Description
name Object The object's name to be associated with the object.
Source:
Returns:
The object's name in UTC-8 ASCII format.
Example
name: "JSFile中国人.txt"

setPayload(payload)

Sets the payload for the StorageObject.

Sets the payload for the StorageObject.
Parameters:
Name Type Description
payload The payload to be associated with StorageObject.
Source:

Type Definitions


errorCallback(statusCode, message)

Callback invoked on error.

Callback invoked on error.
Parameters:
Name Type Description
statusCode Number Any HTTP status code returned from the server, if available.
message String The HTTP payload from the server, if available, or an error message.
Deprecated:
  • Use promises instead
Source:

readPayloadSuccessCallback(statusCode, mobileObject)

Callback invoked after successfully downloading data from the StorageObject.

Callback invoked after successfully downloading data from the StorageObject.
Parameters:
Name Type Description
statusCode Number Any HTTP status code returned from the server, if available.
mobileObject Object The downloaded data.
Deprecated:
  • Use promises instead
Source: