/// <summary> /// Get the characters using the attached APIKeyInfoComponent /// This function will update the character list before returning. /// </summary> /// <exception cref="Exceptions.APIKeyNotFoundException"></exception> /// <exception cref="Exceptions.APIKeyInvalidException"></exception> /// <exception cref="Exceptions.APIKeyPermissionsNotFoundException"></exception> /// <exception cref="Exceptions.APIKeyLacksPermissionException"></exception> /// <returns>List of all characters for the account.</returns> public List <Character> getCharacters() { APIKeyInfoComponent info = GetComponent <APIKeyInfoComponent>(); APIKeyPermissionsComponent permissions = GetComponent <APIKeyPermissionsComponent>(); if (info == null) { throw new Exceptions.APIKeyNotFoundException(); } if (!info.isValid()) { throw new Exceptions.APIKeyInvalidException(); } if (permissions == null) { throw new Exceptions.APIKeyPermissionsNotFoundException(); } if (!permissions.hasRequiredPermission("characters")) { throw new Exceptions.APIKeyLacksPermissionException("characters"); } List <string> chars = requestJSON <List <string> >(URL + "?access_token=" + GetComponent <APIKeyInfoComponent>().getAPIKey()); foreach (string c in chars) { requestCharacter(c); } return(characters); }
public void instantiate() { permissions = GetComponent <APIKeyPermissionsComponent>(); if (permissions == null) { permissions = attachedOn.AddComponent <APIKeyPermissionsComponent>(null); } if ((bankinfo = GetComponent <Bank.BankRequestComponent>()) == null) { bankinfo = attachedOn.AddComponent <Bank.BankRequestComponent>(null); } if ((characters = GetComponent <Characters.CharacterRequestComponent>()) == null) { characters = attachedOn.AddComponent <Characters.CharacterRequestComponent>(null); } if ((inventory = GetComponent <Inventory.InventoryRequestComponent>()) == null) { inventory = attachedOn.AddComponent <Inventory.InventoryRequestComponent>(null); } if ((materials = GetComponent <Materials.MaterialStorageRequestComponent>()) == null) { materials = attachedOn.AddComponent <Materials.MaterialStorageRequestComponent>(null); } instantiated = true; }
public OverlayInfo() { object[] o = { Properties.Settings.Default.APIKey }; InitializeComponent(); obj = new GW2Object(); apikey = obj.AddComponent <APIKeyInfoComponent>(o); permissions = obj.AddComponent <APIKeyPermissionsComponent>(null); accountInfo = obj.AddComponent <AccountComponent>(null); obj.AddComponent <ItemTradeComponent>(null); loadItemProjects(); }
/// <summary> /// Fetches the the account inventory. /// </summary> public void fetchItems() { APIKeyInfoComponent info = GetComponent <APIKeyInfoComponent>(); APIKeyPermissionsComponent permissions = GetComponent <APIKeyPermissionsComponent>(); if (info == null) { throw new Exceptions.APIKeyNotFoundException(); } if (!info.isValid()) { throw new Exceptions.APIKeyInvalidException(); } if (permissions == null) { throw new Exceptions.APIKeyPermissionsNotFoundException(); } if (!permissions.hasRequiredPermission("inventories")) { throw new Exceptions.APIKeyLacksPermissionException(); } accountInventory = requestJSON <List <Characters.Inventory> >(URL + GetComponent <APIKeyInfoComponent>().getAPIKey()); }
public void fetchItems() { APIKeyInfoComponent info = GetComponent <APIKeyInfoComponent>(); APIKeyPermissionsComponent permissions = GetComponent <APIKeyPermissionsComponent>(); if (info == null) { throw new Exceptions.APIKeyNotFoundException(); } if (!info.isValid()) { throw new Exceptions.APIKeyInvalidException(); } if (permissions == null) { throw new Exceptions.APIKeyPermissionsNotFoundException(); } if (!permissions.hasRequiredPermission("inventories")) { throw new Exceptions.APIKeyLacksPermissionException("inventories"); } storage = requestJSON <List <MaterialStorageItem> >(URL + info.getAPIKey()); }