Interface IProvidesCloudDataStorage
Defines the API for a Cloud Data Storage Provider This functionality provider is responsible for providing a storage in the cloud for
Namespace: Unity.MARS.Providers
Syntax
public interface IProvidesCloudDataStorage : IFunctionalityProvider
Methods
CloudLoadAsync(String, Action<Boolean, Int64, Byte[]>, ProgressCallback)
Load from the cloud asynchronously the byte array which was saved with a known key
Declaration
void CloudLoadAsync(string key, Action<bool, long, byte[]> callback, ProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | string that uniquely identifies this instance of the type. |
Action<Boolean, Int64, Byte[]> | callback | a callback which returns whether the operation was successful, as well as the response code and byte array if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
CloudLoadAsync(String, Action<Boolean, Int64, String>, ProgressCallback)
Load from the cloud asynchronously the data of an object of a certain type which was saved with a known key
Declaration
void CloudLoadAsync(string key, Action<bool, long, string> callback, ProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | string that uniquely identifies this instance of the type. |
Action<Boolean, Int64, String> | callback | a callback which returns whether the operation was successful, as well as the response code and serialized string of the object if it was. |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
CloudLoadTextureAsync(String, LoadTextureCallback, ProgressCallback)
Load a texture asynchronously from cloud storage
Declaration
void CloudLoadTextureAsync(string key, LoadTextureCallback callback, ProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type. |
LoadTextureCallback | callback | A callback which returns whether the operation was successful, as well as the response payload if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
CloudSaveAsync(String, Byte[], Action<Boolean, Int64, String>, ProgressCallback)
Save to the cloud asynchronously data in a byte array with a specified key
Declaration
void CloudSaveAsync(string key, byte[] bytesObject, Action<bool, long, string> callback = null, ProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | string that uniquely identifies this instance of the type. |
Byte[] | bytesObject | Bytes array of the object being saved |
Action<Boolean, Int64, String> | callback | a callback when the asynchronous call is done to show whether it was successful, with the response code and string. |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
CloudSaveAsync(String, String, Action<Boolean, Int64, String>, ProgressCallback)
Save to the cloud asynchronously the data of an object of a certain type with a specified key
Declaration
void CloudSaveAsync(string key, string serializedObject, Action<bool, long, string> callback = null, ProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
String | key | string that uniquely identifies this instance of the type. |
String | serializedObject | string serialization of the object being saved. |
Action<Boolean, Int64, String> | callback | a callback when the asynchronous call is done to show whether it was successful, with the response code and string. |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
GetAPIKey()
Get the current authentication token
Declaration
string GetAPIKey()
Returns
Type | Description |
---|---|
String | String that uniquely identifies this instance of the type. |
GetProjectIdentifier()
Set the current project identifier
Declaration
string GetProjectIdentifier()
Returns
Type | Description |
---|---|
String | String that uniquely identifies this instance of the type. |
IsConnected()
Get the current state of the connection to the cloud storage
Declaration
bool IsConnected()
Returns
Type | Description |
---|---|
Boolean | True if the Cloud Storage is connected to this client, false otherwise. |
LoadLocalTextureAsync(String, LoadTextureCallback, ProgressCallback)
Load a texture asynchronously from local storage
Declaration
void LoadLocalTextureAsync(string path, LoadTextureCallback callback, ProgressCallback progress = null)
Parameters
Type | Name | Description |
---|---|---|
String | path | Path to the texture. |
LoadTextureCallback | callback | A callback which returns whether the operation was successful, as well as the response payload if it was. If the operation failed, the byte array will contain the error string |
ProgressCallback | progress | Called every frame while the request is in progress with two 0-1 values indicating upload and download progress, respectively |
SetAPIKey(String)
Set the current authentication token
Declaration
void SetAPIKey(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | String that uniquely identifies this instance of the type. |
SetProjectIdentifier(String)
Set the current project identifier
Declaration
void SetProjectIdentifier(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id | String that uniquely identifies this instance of the type. |