Unity wrapper for the Pantry API - https://getpantry.cloud
Install via UPM package with git reference or asset package(UniPantry...*.unitypackage) available in UniPantry/releases.
Use UPM to install the package via the following git URL:
https://github.com/dkoleev/UniPantry.git
using Yogi.UniPantry.Runtime;
var pantry = new Pantry();
Given a PantryID, return the details of the pantry, including a list of baskets currently stored inside it.
using Yogi.UniPantry.Runtime;
private void GetPantry() {
StartCoroutine(
pantry.GetPantry(pantryId,
info => {
if (info is not null) {
Debug.Log($"name: {info.name} description: {info.description} percentFull: {info.percentFull} errors: {info.errors}");
foreach (var infoBasket in info.baskets) {
Debug.Log(infoBasket.name);
}
}
})
);
}
using Yogi.UniPantry.Runtime;
private void UpdatePantryInfo() {
StartCoroutine(
pantry.UpdatePantryInfo(pantryId, "new name", "new description",
info => {
if (info is not null) {
Debug.Log($"name: {info.name} description: {info.description} percentFull: {info.percentFull} errors: {info.errors}");
foreach (var infoBasket in info.baskets) {
Debug.Log(infoBasket.name);
}
}
})
);
}
Given a basket name, return the full contents of the basket.
using Yogi.UniPantry.Runtime;
private void GetBasket() {
StartCoroutine(_pantry.GetBasket(pantryId, basketId, Debug.Log));
}
Given a basket name as provided in the url, this will either create a new basket inside your pantry, or replace an existing one.
using Yogi.UniPantry.Runtime;
private void CreateBasket() {
var content = JsonUtility.ToJson(SOME_SERIALIZABLE_CLASS);
StartCoroutine(_pantry.CreateBasket(pantryId, basketId, content, Debug.Log));
}
Given a basket name, this will update the existing contents and return the contents of the newly updated basket. This operation performs a deep merge and will overwrite the values of any existing keys, or append values to nested objects or arrays.
using Yogi.UniPantry.Runtime;
private void UpdateBasket() {
var content = JsonUtility.ToJson(SOME_SERIALIZABLE_CLASS);
StartCoroutine(_pantry.UpdateBasket(pantryId, basketId, content, Debug.Log));
}
Delete the entire basket. Warning, this action cannot be undone.
using Yogi.UniPantry.Runtime;
private void DeleteBasket() {
StartCoroutine(_pantry.DeleteBasket(pantryId, basketId, Debug.Log));
}