Show / Hide Table of Contents

Class Datastore

A cloud-based data storage system. It's completely up to you what you use this for. The more inventive the better! Caution: GameJolt has a hard limit of 16MB per key-value pair and a soft limit of 1MB per post-request.

Inheritance
System.Object
Service
Datastore
Inherited Members
Service.Api
Service.Wrap(Task<Response>, Action<Response>)
Service.Wrap<T>(Task<Response<T>>, Action<Response<T>>)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: GameJolt.Services
Assembly: GameJolt.dll
Syntax
public sealed class Datastore : Service

Methods

| Improve this Doc View Source

Fetch(String, Credentials, Action<Response<String>>)

Returns data from the data store.

Declaration
public void Fetch(string key, Credentials credentials = null, Action<Response<string>> callback = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to fetch.

Credentials credentials

If provided, the data is retrieved from the user's personal storage. If left empty, the data is retrieved from the global storage.

System.Action<Response<System.String>> callback

Action that is called on completion or error.

| Improve this Doc View Source

FetchAsync(String, Credentials)

Returns data from the data store.

Declaration
public Task<Response<string>> FetchAsync(string key, Credentials credentials = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to fetch.

Credentials credentials

If provided, the data is retrieved from the user's personal storage. If left empty, the data is retrieved from the global storage.

Returns
Type Description
System.Threading.Tasks.Task<Response<System.String>>
| Improve this Doc View Source

GetKeys(Credentials, String, Action<Response<String[]>>)

Returns either all the keys in the game's global data store, or all the keys in a user's data store.

Declaration
public void GetKeys(Credentials credentials = null, string pattern = null, Action<Response<string[]>> callback = null)
Parameters
Type Name Description
Credentials credentials

If provided, the keys are retrieved from the user's personal storage. If left empty, the keys are retrieved from the global storage.

System.String pattern

If you apply a pattern to the request, only keys with applicable key names will be returned. The placeholder character for patterns is *.

System.Action<Response<System.String[]>> callback

Action that is called on completion or error.

| Improve this Doc View Source

GetKeysAsync(Credentials, String)

Returns either all the keys in the game's global data store, or all the keys in a user's data store.

Declaration
public Task<Response<string[]>> GetKeysAsync(Credentials credentials = null, string pattern = null)
Parameters
Type Name Description
Credentials credentials

If provided, the keys are retrieved from the user's personal storage. If left empty, the keys are retrieved from the global storage.

System.String pattern

If you apply a pattern to the request, only keys with applicable key names will be returned. The placeholder character for patterns is *.

Returns
Type Description
System.Threading.Tasks.Task<Response<System.String[]>>
| Improve this Doc View Source

Remove(String, Credentials, Action<Response>)

Removes data from the data store.

Declaration
public void Remove(string key, Credentials credentials = null, Action<Response> callback = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to remove.

Credentials credentials

If you pass in the user information, the item will be removed from a user's data store. If you leave the user information empty, it will be removed from the game's global data store.

System.Action<Response> callback

Action that is called on completion or error.

| Improve this Doc View Source

RemoveAsync(String, Credentials)

Removes data from the data store.

Declaration
public Task<Response> RemoveAsync(string key, Credentials credentials = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to remove.

Credentials credentials

If you pass in the user information, the item will be removed from a user's data store. If you leave the user information empty, it will be removed from the game's global data store.

Returns
Type Description
System.Threading.Tasks.Task<Response>
| Improve this Doc View Source

Set(String, String, Credentials, Action<Response>)

Sets data in the data store. You can create new data store items by passing in a key that doesn't yet exist in the data store. Caution: GameJolt has a hard limit of 16MB per key-value pair and a soft limit of 1MB per post-request. If your data is not url conform, it will be url encoded, which further increases the payload size. For example the '+' character will be encoded as "%2B".

Declaration
public void Set(string key, string data, Credentials credentials = null, Action<Response> callback = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to set.

System.String data

The data you'd like to set.

Credentials credentials

If you pass in the user information, this item will be set in a user's data store. If you leave the user information empty, it will be set in the game's global data store.

System.Action<Response> callback

Action that is called on completion or error.

| Improve this Doc View Source

SetAsync(String, String, Credentials)

Sets data in the data store. You can create new data store items by passing in a key that doesn't yet exist in the data store. Caution: GameJolt has a hard limit of 16MB per key-value pair and a soft limit of 1MB per post-request. If your data is not url conform, it will be url encoded, which further increases the payload size. For example the '+' character will be encoded as "%2B".

Declaration
public Task<Response> SetAsync(string key, string data, Credentials credentials = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to set.

System.String data

The data you'd like to set.

Credentials credentials

If you pass in the user information, this item will be set in a user's data store. If you leave the user information empty, it will be set in the game's global data store.

Returns
Type Description
System.Threading.Tasks.Task<Response>
| Improve this Doc View Source

Update(String, String, DatastoreOperation, Credentials, Action<Response<String>>)

Updates data in the data store. On success, the new value of the data item is returned. Caution: GameJolt has a hard limit of 16MB per key-value pair and a soft limit of 1MB per post-request.

Declaration
public void Update(string key, string data, DatastoreOperation operation, Credentials credentials = null, Action<Response<string>> callback = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to update.

System.String data

The value you'd like to apply to the data store item.

DatastoreOperation operation

The operation you'd like to perform. Add, Subtract, Multiply and Divide are only applicable to numeric values.

Credentials credentials

If you pass in the user information, this function will use the user's data store. If you leave the user information empty, it will use the game's global data store.

System.Action<Response<System.String>> callback

Action that is called on completion or error.

| Improve this Doc View Source

UpdateAsync(String, String, DatastoreOperation, Credentials)

Updates data in the data store. On success, the new value of the data item is returned. Caution: GameJolt has a hard limit of 16MB per key-value pair and a soft limit of 1MB per post-request.

Declaration
public Task<Response<string>> UpdateAsync(string key, string data, DatastoreOperation operation, Credentials credentials = null)
Parameters
Type Name Description
System.String key

The key of the data item you'd like to update.

System.String data

The value you'd like to apply to the data store item.

DatastoreOperation operation

The operation you'd like to perform. Add, Subtract, Multiply and Divide are only applicable to numeric values.

Credentials credentials

If you pass in the user information, this function will use the user's data store. If you leave the user information empty, it will use the game's global data store.

Returns
Type Description
System.Threading.Tasks.Task<Response<System.String>>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX