Exemple #1
0
        /// <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);
        }
        /// <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());
        }
Exemple #3
0
        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());
        }