Class: StorageCollection

StorageCollection


new StorageCollection()

Class that holds the StorageCollection resource.

Class that holds the StorageCollection resource. StorageCollections contain Storage objects which can be used to persist data in Oracle Mobile Cloud Service.
Source:

Members


description :String

The description of the StorageCollection.

The description of the StorageCollection.
Type:
  • String
Deprecated:
Source:

id :String

The ID of the StorageCollection.

The ID of the StorageCollection.
Type:
  • String
Source:

Methods


contains(id, successCallback, errorCallback)

Checks the service if a StorageObject with the given ID exists in the collection.

Checks the service if a StorageObject with the given ID exists in the collection.
Parameters:
Name Type Argument Description
id String The ID of the StorageObject to check.
successCallback StorageCollection~storageCollectionSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageCollection~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(NetworkResponse|NetworkResponse)>
Example
id: "00e394532-9652-458b-9a82-d1a47cf1a0c7"

deleteObject(id, successCallback, errorCallback)

Deletes a StorageObject from a collection.

Deletes a StorageObject from a collection.
Parameters:
Name Type Argument Description
id String The ID of the StorageObject to delete.
successCallback StorageCollection~storageCollectionSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageCollection~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(NetworkResponse|NetworkResponse)>
Example
id: "00e394532-9652-458b-9a82-d1a47cf1a0c7"

getData()

Returns data for current storage collection.

Returns data for current storage collection.
Source:
Returns:
storage object data for current storage collection.

getDescription()

The description of the StorageCollection.

The description of the StorageCollection.
Deprecated:
Source:

getObject(id, successCallback, errorCallback, objectType)

Returns a StorageObject given its ID.

Returns a StorageObject given its ID. The contents of the object will be downloaded lazily.
Parameters:
Name Type Argument Description
id String The ID of the Storage Object to return.
successCallback StorageCollection~storageObjectSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageCollection~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
objectType object responseType for the XMLHttpRequest Object. Default response type if not defined is json.
Source:
Returns:
Type
Promise.<(StorageObject|NetworkResponse)>
Examples
StorageCollection.getObject(id,successCallback,errorCallback,objectType);
id: "00e39862-9652-458b-9a82-d1a66cf1a0c7"
<caption>Example usage of StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","blob")</caption>
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","blob");
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7", "blob").then(
function(StorageObject){
},
function(NetworkResponse){
});
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","arraybuffer");
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","arraybuffer").then(
function(StorageObject){
},
function(NetworkResponse){
});
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","document");
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7", "document").then(
function(StorageObject){
},
function(NetworkResponse){
});
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","text");
StorageCollection.getObject("00e39862-9652-458b-9a82-d1a66cf1a0c7","text").then(
function(StorageObject){
},
function(NetworkResponse){
});

getObjects(offset, limit, allObjects, successCallback, errorCallback)

Returns a list of StorageObjects from the collection starting from the offset and up to the limit.

Returns a list of StorageObjects from the collection starting from the offset and up to the limit. The service may return fewer objects. 1. If the collection is a shared collection, then it returns all the objects. 2. If the collection is a user-isolated collection and allObjects is false, then it returns the objects which belong to the current user. 3. If the collection is user-isolated collection, and allObjects is true, then it returns all the objects in the collection. The objects might belong to other users. And the current user MUST have READ_ALL or READ_WRITE_ALL permission.
Parameters:
Name Type Argument Description
offset Number The offset at which to start. Must be greater than 0.
limit Number The max number of StorageObjects to return. Must be non-negative.
allObjects Boolean whether to return all the objects in the list.
successCallback StorageCollection~getObjectsSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageCollection~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(Array.<StorageObject>|NetworkResponse)>
Examples
offset: "3"
limit: "2"

getStorage()

Returns storage object for current storage collection.

Returns storage object for current storage collection.
Source:
Returns:
storage object data for current storage collection.

getUserId()

Returns user ID for current storage collection.

Returns user ID for current storage collection.
Source:
Returns:
user ID for current storage collection.

loadMetadata()

Load collection metadata.

Load collection metadata
Source:
Returns:
Type
Promise.<(StorageCollection|NetworkResponse)>

postObject(storageObject, successCallback, errorCallback)

Creates a new StorageObject in the collection.

Creates a new StorageObject in the collection.
Parameters:
Name Type Argument Description
storageObject StorageObject The StorageObject to create.
successCallback StorageCollection~storageObjectSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageCollection~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(NetworkResponse|NetworkResponse)>
Example
storageObject:
{
"id": " 213ddbac-ccb2-4a53-ad48-b4588244tc4c", // A service generated ID for the StorageObject. The ID is unique in the StorageCollection.
"name" : "JSText.txt", // A user provided name for the StorageObject. A StorageCollection may have multiple StorageObjects with the same name.
"contentLength": 798", // The length of data content in bytes stored in the StorageObject.
"contentType" : "text/plain ", // The media-type associated with the StorageObject.
"createdBy" : "DwainDRob", // The name of the user who created the StorageObject
"createdOn": "Sat, 17 Oct 2015 10:33:12", // Server generated timestamp when the StorageObject was created.
"modifiedBy": "DwainDRob", // The name of the user who last updated the StorageObject.
"modifiedOn": "Sat, 17 Oct 2015 10:33:12" //  Server generated timestamp when the StorageObject was last updated.
}

putObject(storageObject, successCallback, errorCallback)

Updates an existing StorageObject in the collection.

Updates an existing StorageObject in the collection.
Parameters:
Name Type Argument Description
storageObject StorageObject The StorageObject to update.
successCallback StorageCollection~storageObjectSuccessCallback <optional>
Callback invoked on success (deprecated use promises instead).
errorCallback StorageCollection~errorCallback <optional>
Callback invoked on error (deprecated use promises instead).
Source:
Returns:
Type
Promise.<(NetworkStorageObject|NetworkResponse)>

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:

getObjectsSuccessCallback(objects)

Callback invoked after successfully fetching a StorageCollection.

Callback invoked after successfully fetching a StorageCollection.
Parameters:
Name Type Description
objects Array An array of StorageObjects downloaded from the service.
Deprecated:
  • Use promises instead
Source:

storageCollectionSuccessCallback()

Callback invoked after a successful operation.

Callback invoked after a successful operation.
Deprecated:
  • Use promises instead
Source:

storageObjectSuccessCallback(object)

Callback invoked after successfully fetching a StorageObject.

Callback invoked after successfully fetching a StorageObject.
Parameters:
Name Type Description
object StorageObject The StorageObject downloaded from the service.
Deprecated:
  • Use promises instead
Source: