// This method tests Enjin's non-runtime API methods mostly used in the editor window. private void TestStaticEndpoints() { // Helper methods. TestMethod(() => { Enjin.StoreUserData(new User(), "test"); }, "user data storage"); TestMethod <Boolean>(() => { return(Enjin.ValidateAddress("0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c")); }, true, "address validation"); TestMethod(() => { Enjin.URLGetData("https://enjincoin.io/", new System.Collections.Generic.Dictionary <string, string>()); }, "fetching URL data"); TestMethod <String>(() => { return(Enjin.URLGetData("bad URL", new System.Collections.Generic.Dictionary <string, string>())); }, string.Empty, "expected result from bad URL data"); TestMethod(() => { Enjin.ResetErrorReport(); }, "error report reset"); // CryptoItems methods. TestMethod(() => { Enjin.GetCryptoItemBalance(testingIdentityID, TESTING_ITEM_ID); }, "balance by identity"); TestMethod(() => { Enjin.GetMintableItems(TESTING_ITEM_ID); }, "mintable item retrieval"); TestMethod(() => { CryptoItem item = Enjin.GetCryptoItem(TESTING_ITEM_ID); Enjin.GetCryptoItemIDByName(item.name); }, "item identity by name"); TestMethod(() => { Enjin.GetCryptoItemBalances(testingIdentityID); }, "all balances by identity"); TestMethod(() => { Enjin.UpdateCryptoItem(new CryptoItem()); }, "item updating"); TestMethod(() => { Enjin.GetAllCryptoItems(); }, "searching all items"); TestMethod(() => { CryptoItem item = Enjin.GetCryptoItem(TESTING_ITEM_ID); Enjin.GetCryptoItemIDByName(item.name); }, "searching for item name"); TestMethod(() => { Enjin.GetAllItems(0, 0, DEVELOPER_IDENTITY_ID); }, "getting all items by page"); TestMethod(() => { Enjin.GetAllItems(DEVELOPER_IDENTITY_ID); }, "getting all items"); // Enjin Platform API methods. TestMethod(() => { Enjin.GetTotalActiveTokens(DEVELOPER_IDENTITY_ID); }, "getting all active tokens"); TestMethod(() => { Enjin.GetAppsByUserID(loginUser.id); }, "getting apps for user"); TestMethod(() => { Enjin.GetAppByID(APP_ID); }, "getting app by id"); // Identity methods. TestMethod(() => { Enjin.UpdateBalances(new Identity()); }, "identity balance updates"); TestMethod(() => { Enjin.GetIdentity(testingIdentityID); }, "identity retrieval"); TestMethod(() => { Enjin.GetAllIdentities(); }, "bulk identity retrieval"); TestMethod(() => { Enjin.SearchIdentities("enjin"); }, "identity search"); Identity sampleIdentity = new Identity { user = new Identity.User { name = loginUser.name, id = loginUser.id }, id = testingIdentityID, fields = new Fields[] { new Fields("test", "enjin", 0, 0, 0) } }; TestMethod(() => { Enjin.UpdateIdentity(sampleIdentity); }, "identity update"); Enjin.AccessToken = TESTER_TOKEN; TestMethod(() => { Enjin.UpdateIdentityFields(testingIdentityID, new Fields[] { new Fields("test", "enjin!", 0, 0, 0) }); }, "identity field update"); TestMethod(() => { Enjin.LinkIdentity(sampleIdentity); }, "identity link"); TestMethod(() => { Enjin.UnLinkIdentity(testingIdentityID); }, "identity unlinking"); TestMethod(() => { Enjin.DeleteIdentity(testingIdentityID + ""); }, "identity deletion"); TestMethod(() => { Enjin.CreateIdentity(sampleIdentity); }, "identity creation"); TestMethod(() => { Enjin.GetRoles(); }, "fetching identity roles"); TestMethod(() => { Enjin.GetIdentities(0, 0); }, "fetching identity pages"); }
/// <summary> /// Method to reset and refresh the list of Identities /// </summary> public void RefreshLists() { ResetLists(); CurrentPage = FirstPage; Pagination = Enjin.GetIdentities(CurrentPage, EnjinEditor.ItemsPerPage); TotalPages = (int)Mathf.Ceil((float)Pagination.cursor.total / (float)Pagination.cursor.perPage); IdentitiesList = new List <Identity>(Pagination.items); for (int i = 0; i < IdentitiesList.Count; i++) { FieldsFoldout.Add(false); } }
public void PageCheck() { if (CurrentPage < FirstPage) { FirstPage = CurrentPage; } if (CurrentPage == (FirstPage + 10)) { FirstPage++; } Pagination = Enjin.GetIdentities(CurrentPage, EnjinEditor.ItemsPerPage); IdentitiesList = new List <Identity>(Pagination.items); SelectedIndex = 0; }