![]() |
CotC C# SDK for Unity
v1.4.0.1
Making social games is easy !
|
Represents a key/value system with ACL rights, also known as key/value store. This class is scoped by domain, meaning that you can call .Domain("yourdomain") and perform additional calls that are scoped.
ACL rights simply define the lists of gamers authorized to perform certain actions related to a specific key. There are 3 types of rights:
r
(read): Allows gamers to get key's value and ACL rightsw
(write): Allows gamers to set key's value (but not ACL rights!)a
(acl/delete): Allows gamers to change key's ACL rights setup and to delete the keyEach of those ACL rights can take one of the following values:
["gamerID1", "gamerID2", ...]
: An array of gamerIDs (all gamers with their gamerID
in this array will be authorized for the corresponding ACL right, the other ones won't)"*"
: A wildcard string (all gamers will be authorized for the corresponding ACL right)According to all this, an example "ACL setup object" would look like:
Meaning:
An equivalent C# code to generate this object would be:
Or:
One last thing: as the GamerKvStore feature is similar to the GameVfs one (as keys are scoped by game, not scoped by gamers), client SDKs are unauthorized to directly create keys by themselves. As you can't set
key's value before you created the key, you'll have to call for a gamer batch to create
it first (see GamerBatches). Moreover, in order to use the KvStore API to create a key you'll have to convert all gamerIDs into ObjectIDs.
Here is a sample Javascript batch code you can directly paste for this:
Finally, the corresponding C# code to run this batch with the corresponding parameters:
Public Member Functions | |
GamerKvStore | Domain (string domain) |
Sets the domain affected by this object. You should typically use it this way: gamer.KvStore.Domain("private").Set(...); More... | |
Promise< Bundle > | GetValue (string key) |
Retrieves an individual key from the key/value store if the gamer calling this API is granted read right for this key. About ACL rights, have a look at GamerKvStore's class comments. More... | |
Promise< Done > | SetValue (string key, Bundle value) |
Sets the value of an individual key from the key/value store if the gamer calling this API is granted write right for this key. About ACL rights, have a look at GamerKvStore's class comments. More... | |
Promise< Done > | DeleteKey (string key) |
Removes an individual key from the key/value store if the gamer calling this API is granted acl/delete right for this key. About ACL rights, have a look at GamerKvStore's class comments. More... | |
Promise< Done > | ChangeACL (string key, Bundle value) |
Changes ACL rights setup of an individual key from the key/value store if the gamer calling this API is granted acl/delete right for this key. About ACL rights, have a look at GamerKvStore's class comments. More... | |
Changes ACL rights setup of an individual key from the key/value store if the gamer calling this API is granted acl/delete right
for this key. About ACL rights, have a look at GamerKvStore's class comments.
Successful
attribute to be true
to confirm a key has been changed (if the given key doesn't exist or the calling gamer doesn't have proper right, Successful == false
would be returned).key | The name of the key to change the ACL rights for. |
value | The ACL rights setup value to set, as a Bundle. |
Removes an individual key from the key/value store if the gamer calling this API is granted acl/delete right
for this key. About ACL rights, have a look at GamerKvStore's class comments.
Successful
attribute to be true
to confirm a key has been deleted (if the given key doesn't exist or the calling gamer doesn't have proper right, Successful == false
would be returned).key | The name of the key to remove. |
GamerKvStore CotcSdk.GamerKvStore.Domain | ( | string | domain | ) |
Sets the domain affected by this object. You should typically use it this way: gamer.KvStore.Domain("private").Set(...);
domain | Domain on which to scope the key/value store. Defaults to private if not specified. |
Retrieves an individual key from the key/value store if the gamer calling this API is granted read right
for this key. About ACL rights, have a look at GamerKvStore's class comments.
value
(key's value) and acl
(key's ACL rights setup).key | The name of the key to be fetched. A null or empty key name will be responded with a 404 (ObsoleteRoute) error. |
Sets the value of an individual key from the key/value store if the gamer calling this API is granted write right
for this key. About ACL rights, have a look at GamerKvStore's class comments.
Successful
attribute to be true
to confirm a key has been set (if the given key doesn't exist or the calling gamer doesn't have proper right, Successful == false
would be returned).key | The name of the key to set the value for. |
value | The value to set, as a Bundle. |