loicteixeira / gj-unity-api

[MOVED] Game Jolt API wrapper for Unity.
https://github.com/InfectedBytes/gj-unity-api/
MIT License
16 stars 13 forks source link

Update DataStorage#Set with API 1.2 new capabilities #27

Closed loicteixeira closed 6 years ago

loicteixeira commented 9 years ago

The DataStorage#Set endpoint now allows restrictions to be set on a specific key so only a specific user can update it.

InfectedBytes commented 6 years ago

implementing the feature itself is straightforward, but we need to discuss the API signature. I think there are two main approaches:

  1. Adding a dedicated function like DataStore.SetProtected(string key, string value, Action<bool> callback = null)
  2. Changing the signature from DataStore.Set(string key, string value, bool global, Action<bool> callback = null) to Set(string key, string value, AccessRestriction access, Action<bool> callback = null), where AccessRestriction is an enum: public enum AccessRestriction { Public, Protected, Private } In the later case we could also keep a method with the old signature and let it call the new method with the corresponding AccessRestriction
loicteixeira commented 6 years ago

DataStore.SetProtected could be a nice, but it would probably need DataStore.SetPublic and DataStore.SetPrivate as well. But anyway, DataStore.Set would probably need rewriting to accommodate the new options (otherwise we will have a duplicated implementation of the Set method) so we might as well go with option 2.

I agree with that the change needs to be backward compatible with the old method calling the new one. This should also issue a deprecation warning so developers have time to update and the old method can be removed in a couple version. The new signature looks good to me.

PS: I've updated the issue body with a link to the documentation for reference.

InfectedBytes commented 6 years ago

GameJolt does not yet support this feature and it wasn't supposed to appear in the official documentation. And as it seems it is not sure if they will implement it at all.

loicteixeira commented 6 years ago

That's a shame. Thank you for your time.

Closing this issue then. This can be re-opened once there has been some progress on gamejolt/doc-game-api#24.