Exemple #1
0
        /// <summary>
        /// Returns one continent that match the id.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="requestedLanguage">The requested language.</param>
        /// <returns>Continent that matches the id.</returns>
        public Continent GetById(int id, RequestedLanguage requestedLanguage)
        {
            Continent continent = DeserializeObject <Continent>(string.Format("https://api.guildwars2.com/v2/continents?id={0}&lang={1}", id, requestedLanguage));

            continent.Language = requestedLanguage;
            return(continent);
        }
 /// <summary>
 /// Returns all the matches
 /// </summary>
 /// <param name="ids">The ids to return</param>
 /// <param name="requestedLanguage">The language to display the results in</param>
 /// <returns>A list of lazy initialised matches</returns>
 public IEnumerable<Lazy<Matches>> GetMultipleById(List<string> ids, RequestedLanguage requestedLanguage = RequestedLanguage.En)
 {
     string url = "https://api.guildwars2.com/v2/wvw/matches?ids=";
     foreach (var id in ids)
     {
         url += id + ",";
     }
     return DeserializeObject<List<Lazy<Matches>>>(url);
 }
        private Dictionary<int, Lazy<Achievement>> InitLazyAchievements(RequestedLanguage requestedLanguage, IEnumerable<int> ids)
        {
            Dictionary<int, Lazy<Achievement>> achievements = new Dictionary<int, Lazy<Achievement>>();
            foreach (var id in ids)
            {
                achievements.Add(id, new Lazy<Achievement>(() => Get(id, requestedLanguage)));
            }

            return achievements;
        }
Exemple #4
0
        /// <summary>
        /// Returns all the objectives
        /// </summary>
        /// <param name="ids">The ids to return</param>
        /// <param name="requestedLanguage">The language to display the results in</param>
        /// <returns>A list of lazy initialised objectives</returns>
        public IEnumerable <Lazy <Objectives> > GetMultiple(List <string> ids, RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            string url = "https://api.guildwars2.com/v2/wvw/objectives?ids=";

            foreach (var id in ids)
            {
                url += id + ",";
            }
            return(DeserializeObject <List <Lazy <Objectives> > >(url));
        }
        /// <summary>
        /// Returns all the matches
        /// </summary>
        /// <param name="requestedLanguage">The language to display the results in</param>
        /// <returns>A list of lazy initialised matches</returns>
        public IEnumerable<Lazy<Matches>> GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            List<string> matchIds = DeserializeObject<List<string>>("https://api.guildwars2.com/v2/wvw/matches");

            var matches = new List<Lazy<Matches>>();
            foreach (var matchesId in matchIds)
            {
                matches.Add(new Lazy<Matches>(() => GetById(matchesId, requestedLanguage)));
            }
            return matches;
        }
        /// <summary>
        /// Returns all the objectives
        /// </summary>
        /// <param name="requestedLanguage">The language to display the results in</param>
        /// <returns>A list of lazy initialised objects</returns>
        public IEnumerable<Lazy<Objectives>> GetAll(RequestedLanguage requestedLanguage)
        {
            List<string> ObjectivesIds = DeserializeObject<List<string>>("https://api.guildwars2.com/v2/wvw/objectives");

            var objectives = new List<Lazy<Objectives>>();
            foreach (var objectivesId in ObjectivesIds)
            {
                objectives.Add(new Lazy<Objectives>(() => GetById(objectivesId, requestedLanguage)));
            }
            return objectives;
        }
        private Dictionary <int, Lazy <Achievement> > InitLazyAchievements(RequestedLanguage requestedLanguage, IEnumerable <int> ids)
        {
            Dictionary <int, Lazy <Achievement> > achievements = new Dictionary <int, Lazy <Achievement> >();

            foreach (var id in ids)
            {
                achievements.Add(id, new Lazy <Achievement>(() => Get(id, requestedLanguage)));
            }

            return(achievements);
        }
        /// <summary>
        /// Returns all known minis.
        /// </summary>
        /// <param name="requestedLanguage">Language in which the API should be called.</param>
        /// <returns>All the known minis.</returns>
        public Dictionary<int, Lazy<Mini>> GetAll(RequestedLanguage requestedLanguage)
        {
            List<int> miniIds = DeserializeObject<List<int>>("https://api.guildwars2.com/v2/minis");

            var minis = new Dictionary<int, Lazy<Mini>>();
            foreach (var miniId in miniIds)
            {
                minis.Add(miniId, new Lazy<Mini>(() => Get(miniId, requestedLanguage)));
            }
            return minis;
        }
        /// <summary>
        /// Returns all maps.
        /// </summary>
        /// <param name="requestedLanguage">Language in which the API should be called.</param>
        /// <returns>Returns all maps.</returns>
        public IEnumerable<Lazy<Map>> GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            List<int> mapIds = DeserializeObject<List<int>>("https://api.guildwars2.com/v2/maps");

            var maps = new List<Lazy<Map>>();
            foreach (var mapId in mapIds)
            {
                maps.Add(new Lazy<Map>(() => GetById(mapId, requestedLanguage)));
            }
            return maps;
        }
        /// <summary>
        /// Returns the a Dictionary with all known colors.
        /// </summary>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>Dictionary with all known colors.</returns>
        public Dictionary<int, Lazy<Color>> GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            List<int> colorIds = DeserializeObject<List<int>>("https://api.guildwars2.com/v2/colors");

            var colors = new Dictionary<int, Lazy<Color>>();
            foreach (var colorId in colorIds)
            {
                colors.Add(colorId, new Lazy<Color>(() => GetById(colorId, requestedLanguage)));
            }
            return colors;
        }
        /// <summary>
        /// Returns all maps.
        /// </summary>
        /// <param name="requestedLanguage">Language in which the API should be called.</param>
        /// <returns>Returns all maps.</returns>
        public IEnumerable <Lazy <Map> > GetAll(RequestedLanguage requestedLanguage)
        {
            List <int> mapIds = DeserializeObject <List <int> >("https://api.guildwars2.com/v2/maps");

            var maps = new List <Lazy <Map> >();

            foreach (var mapId in mapIds)
            {
                maps.Add(new Lazy <Map>(() => GetById(mapId, requestedLanguage)));
            }
            return(maps);
        }
        /// <summary>
        /// Returns all known minis.
        /// </summary>
        /// <param name="requestedLanguage">Language in which the API should be called.</param>
        /// <returns>All the known minis.</returns>
        public Dictionary <int, Lazy <Mini> > GetAll(RequestedLanguage requestedLanguage)
        {
            List <int> miniIds = DeserializeObject <List <int> >("https://api.guildwars2.com/v2/minis");

            var minis = new Dictionary <int, Lazy <Mini> >();

            foreach (var miniId in miniIds)
            {
                minis.Add(miniId, new Lazy <Mini>(() => Get(miniId, requestedLanguage)));
            }
            return(minis);
        }
        /// <summary>
        /// Returns all known skins.
        /// </summary>
        /// <param name="requestedLanguage">(Optional) Request localized information.</param>
        /// <returns>All known skins.</returns>
        public Dictionary<int, Lazy<Skin>> GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            List<int> skinIds = DeserializeObject<List<int>>(string.Format("https://api.guildwars2.com/v2/skins"));

            var skins = new Dictionary<int, Lazy<Skin>>();
            foreach (var skinId in skinIds)
            {
                skins.Add(skinId, new Lazy<Skin>(() => GetById(skinId, requestedLanguage)));
            }

            return skins;
        }
Exemple #14
0
        /// <summary>
        /// Returns all the objectives
        /// </summary>
        /// <param name="requestedLanguage">The language to display the results in</param>
        /// <returns>A list of lazy initialised objects</returns>
        public IEnumerable <Lazy <Objectives> > GetAll(RequestedLanguage requestedLanguage)
        {
            List <string> ObjectivesIds = DeserializeObject <List <string> >("https://api.guildwars2.com/v2/wvw/objectives");

            var objectives = new List <Lazy <Objectives> >();

            foreach (var objectivesId in ObjectivesIds)
            {
                objectives.Add(new Lazy <Objectives>(() => GetById(objectivesId, requestedLanguage)));
            }
            return(objectives);
        }
        /// <summary>
        /// Returns the worlds that matches the ids.
        /// <para>Endpoint: https://api.guildwars2.com/v2/worlds?ids=</para>
        /// </summary>
        /// <param name="ids">The world ids.</param>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>List of worlds that matches the ids.</returns>
        public IEnumerable<World> GetWorldByIds(IEnumerable<int> ids, RequestedLanguage requestedLanguage = RequestedLanguage.en)
        {
            string url = "https://api.guildwars2.com/v2/worlds?ids=";
            foreach (int id in ids)
            {
                url += id + ",";
            }
            url = string.Format("{0}&lang={1}", url, requestedLanguage);

            string jsonString = DownloadJsonString(url);
            return JsonConvert.DeserializeObject<List<World>>(jsonString);
        }
Exemple #16
0
        /// <summary>
        /// Returns the worlds that matches the ids.
        /// <para>Endpoint: https://api.guildwars2.com/v2/worlds?ids=</para>
        /// </summary>
        /// <param name="ids">The world ids.</param>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>List of worlds that matches the ids.</returns>
        public IEnumerable<World> GetWorldByIds(IEnumerable<int> ids, RequestedLanguage requestedLanguage = RequestedLanguage.en)
        {
            string url = "https://api.guildwars2.com/v2/worlds?ids=";
            foreach (int id in ids)
            {
                url += id + ",";
            }
            url = string.Format("{0}&lang={1}", url, requestedLanguage); 

            string jsonString = DownloadJsonString(url);
            return JsonConvert.DeserializeObject<List<World>>(jsonString);
        }
        /// <summary>
        /// Returns the a Dictionary with all known colors.
        /// </summary>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>Dictionary with all known colors.</returns>
        public Dictionary <int, Lazy <Color> > GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            List <int> colorIds = DeserializeObject <List <int> >("https://api.guildwars2.com/v2/colors");

            var colors = new Dictionary <int, Lazy <Color> >();

            foreach (var colorId in colorIds)
            {
                colors.Add(colorId, new Lazy <Color>(() => GetById(colorId, requestedLanguage)));
            }
            return(colors);
        }
        /// <summary>
        /// Returns all known items.
        /// </summary>
        /// <param name="requestedLanguage">Request localized information.</param>
        /// <returns>All known items.</returns>
        public Dictionary<int, Lazy<Item>> GetAll(RequestedLanguage requestedLanguage)
        {
            List<int> itemIds = DeserializeObject<List<int>>(string.Format("https://api.guildwars2.com/v2/items/"));

            var items = new Dictionary<int, Lazy<Item>>();
            foreach (var itemId in itemIds)
            {
                items.Add(itemId, new Lazy<Item>(() => GetById(itemId, requestedLanguage)));
            }

            return items;
        }
        /// <summary>
        /// Returns the worlds that matches the ids.
        /// </summary>
        /// <param name="ids">The world ids.</param>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>List of worlds that matches the ids.</returns>
        public IEnumerable<World> GetByIds(IEnumerable<int> ids, RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            string url = "https://api.guildwars2.com/v2/worlds?ids=";
            foreach (int id in ids)
            {
                url += id + ",";
            }

            url = string.Format("{0}&lang={1}", url, requestedLanguage);

            return DeserializeObject<IEnumerable<World>>(url);
        }
        /// <summary>
        /// Returns all known skins.
        /// </summary>
        /// <param name="requestedLanguage">(Optional) Request localized information.</param>
        /// <returns>All known skins.</returns>
        public Dictionary <int, Lazy <Skin> > GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            List <int> skinIds = DeserializeObject <List <int> >(string.Format("https://api.guildwars2.com/v2/skins"));

            var skins = new Dictionary <int, Lazy <Skin> >();

            foreach (var skinId in skinIds)
            {
                skins.Add(skinId, new Lazy <Skin>(() => GetById(skinId, requestedLanguage)));
            }

            return(skins);
        }
Exemple #21
0
        /// <summary>
        /// Returns the worlds that matches the ids.
        /// </summary>
        /// <param name="ids">The world ids.</param>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>List of worlds that matches the ids.</returns>
        public IEnumerable <World> GetByIds(IEnumerable <int> ids, RequestedLanguage requestedLanguage)
        {
            string url = "https://api.guildwars2.com/v2/worlds?ids=";

            foreach (int id in ids)
            {
                url += id + ",";
            }

            url = string.Format("{0}&lang={1}", url, requestedLanguage);

            return(DeserializeObject <IEnumerable <World> >(url));
        }
        /// <summary>
        /// Returns the a Dictionary with all known colors.
        /// <para>Endpoint: https://api.guildwars2.com/v2/colors</para>
        /// </summary>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>Dictionary with all known colors.</returns>
        public Dictionary<int, Lazy<Color>> GetAllColors(RequestedLanguage requestedLanguage = RequestedLanguage.en)
        {
            string jsonString = DownloadJsonString(string.Format("https://api.guildwars2.com/v2/colors"));

            List<int> colorIds = JsonConvert.DeserializeObject<List<int>>(jsonString);

            var colors = new Dictionary<int, Lazy<Color>>();
            foreach (var colorId in colorIds)
            {
                colors.Add(colorId, new Lazy<Color>(() => GetColorById(colorId, requestedLanguage)));
            }
            return colors;
        }
Exemple #23
0
        /// <summary>
        /// Returns all known items.
        /// </summary>
        /// <param name="requestedLanguage">Request localized information.</param>
        /// <returns>All known items.</returns>
        public Dictionary <int, Lazy <Item> > GetAll(RequestedLanguage requestedLanguage)
        {
            List <int> itemIds = DeserializeObject <List <int> >(string.Format("https://api.guildwars2.com/v2/items/"));

            var items = new Dictionary <int, Lazy <Item> >();

            foreach (var itemId in itemIds)
            {
                items.Add(itemId, new Lazy <Item>(() => GetById(itemId, requestedLanguage)));
            }

            return(items);
        }
        /// <summary>
        /// Returns all known skins.
        /// </summary>
        /// <param name="requestedLanguage">(Optional) Request localized information.</param>
        /// <returns>All known skins.</returns>
        public Dictionary<int, Lazy<Skin>> GetAllSkins(RequestedLanguage requestedLanguage = RequestedLanguage.En)
        {
            string jsonString = DownloadJsonString(string.Format("https://api.guildwars2.com/v2/skins"));

            List<int> skinIds = JsonConvert.DeserializeObject<List<int>>(jsonString);

            var skins = new Dictionary<int, Lazy<Skin>>();
            foreach (var skinId in skinIds)
            {
                skins.Add(skinId, new Lazy<Skin>(() => GetSkinById(skinId, requestedLanguage)));
            }

            return skins;
        }
        /// <summary>
        /// Returns the a Dictionary with all known colors.
        /// <para>Endpoint: https://api.guildwars2.com/v2/colors</para>
        /// </summary>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>Dictionary with all known colors.</returns>
        public Dictionary <int, Lazy <Color> > GetAllColors(RequestedLanguage requestedLanguage = RequestedLanguage.en)
        {
            string jsonString = DownloadJsonString(string.Format("https://api.guildwars2.com/v2/colors"));

            List <int> colorIds = JsonConvert.DeserializeObject <List <int> >(jsonString);

            var colors = new Dictionary <int, Lazy <Color> >();

            foreach (var colorId in colorIds)
            {
                colors.Add(colorId, new Lazy <Color>(() => GetColorById(colorId, requestedLanguage)));
            }
            return(colors);
        }
        public void ShouldReturnSpicific(string mapName, string regionName, string continentName, RequestedLanguage language)
        {
            Map map = GW2Api.V2().Maps.GetById(50, language);

            Assert.AreEqual(50, map.Id);
            Assert.AreEqual(continentName, map.ContinentName);
            Assert.AreEqual(15232, map.ContinentRectangle.X.X);
            Assert.AreEqual(14336, map.ContinentRectangle.X.Y);
            Assert.AreEqual(17664, map.ContinentRectangle.Y.X);
            Assert.AreEqual(15872, map.ContinentRectangle.Y.Y);
            Assert.AreEqual(1, map.DefaultFloor);
            Assert.AreEqual(new List<int> { 0, 1, 2}, map.Floors);
            Assert.AreEqual(-27648, map.MapRectangle.X.X);
            Assert.AreEqual(-18432, map.MapRectangle.X.Y);
            Assert.AreEqual(30720, map.MapRectangle.Y.X);
            Assert.AreEqual(18432, map.MapRectangle.Y.Y);
            Assert.AreEqual(80, map.MaxLevel);
            Assert.AreEqual(0, map.MinLevel);
            Assert.AreEqual(mapName, map.Name);
            Assert.AreEqual(4, map.RegionId);
            Assert.AreEqual(regionName, map.RegionName);
        }
 /// <summary>
 /// The V2 endpoint.
 /// </summary>
 /// <param name="accountToken">Optional Accounttoken which all authenticated calls will automatically use.</param>
 /// <param name="language">Optional language in which all calls should be made.</param>
 public V2Endpoint(string accountToken, RequestedLanguage language)
 {
     this.accountToken = accountToken;
     this.language     = language;
 }
 /// <summary>
 /// Returns a wrapper for all achievements endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public AchievementWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
        /// <summary>
        /// Returns all achievements.
        /// </summary>
        /// <param name="requestedLanguage">Language in which the object should be.</param>
        /// <returns>All Achievments.</returns>
        public Dictionary <int, Lazy <Achievement> > GetAll(RequestedLanguage requestedLanguage)
        {
            List <int> ids = DeserializeObject <List <int> >("https://api.guildwars2.com/v2/achievements");

            return(InitLazyAchievements(requestedLanguage, ids));
        }
Exemple #30
0
 /// <summary>
 /// Returns all continents.
 /// </summary>
 /// <param name="requestedLanguage">The requested language.</param>
 /// <returns>All continents.</returns>
 public IEnumerable <Continent> GetAll(RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <IEnumerable <Continent> >(string.Format("https://api.guildwars2.com/v2/continents?ids=all&lang={0}", requestedLanguage)));
 }
Exemple #31
0
 /// <summary>
 /// Returns a wrapper for all continent endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public ContinentWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Returns a single mini that matches the id.
 /// </summary>
 /// <param name="id">The mini identifier.</param>
 /// <param name="requestedLanguage">Language in which the API should be called.</param>
 /// <returns>Mini that matches the id.</returns>
 public Mini Get(int id, RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <Mini>(string.Format("https://api.guildwars2.com/v2/minis/{0}", id)));
 }
        /// <summary>
        /// Returns the color that matches the id.
        /// <para>Endpoint: https://api.guildwars2.com/v2/colors/{0}?lang={1}</para>
        /// </summary>
        /// <param name="id">The color id.</param>
        /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
        /// <returns>Color that matches the id.</returns>
        public Color GetColorById(int id, RequestedLanguage requestedLanguage = RequestedLanguage.en)
        {
            string jsonString = DownloadJsonString(string.Format("https://api.guildwars2.com/v2/colors/{0}?lang={1}", id, requestedLanguage));

            return(JsonConvert.DeserializeObject <Color>(jsonString));
        }
Exemple #34
0
 /// <summary>
 /// Returns a wrapper for all the wvw objectives endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public ObjectivesWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
Exemple #35
0
 /// <summary>
 /// Get an objective using its id
 /// </summary>
 /// <param name="id">The id of the objective</param>
 /// <param name="requestedLanguage">The language to display the results in</param>
 /// <returns>An objective containing the results</returns>
 public Objectives GetById(string id, RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <Objectives>(string.Format("https://api.guildwars2.com/v2/wvw/objectives?id={0}&lang={1}", id, requestedLanguage)));
 }
 /// <summary>
 /// Returns a single mini that matches the id.
 /// </summary>
 /// <param name="id">The mini identifier.</param>
 /// <param name="requestedLanguage">Language in which the API should be called.</param>
 /// <returns>Mini that matches the id.</returns>
 public Mini Get(int id, RequestedLanguage requestedLanguage)
 {
     return DeserializeObject<Mini>(string.Format("https://api.guildwars2.com/v2/minis/{0}", id));
 }
        public void ShouldReturnSpecificSkinInLanguage(RequestedLanguage requestedLanguage, string expectedName)
        {
            Skin skin = GW2Api.V2().Skins.GetById(1, requestedLanguage);

            Assert.AreEqual(expectedName, skin.Name);
        }
 /// <summary>
 /// A wrapper for all color endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public ColorWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Returns all currencies.
 /// </summary>
 /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
 /// <returns>All currencies.</returns>
 public IEnumerable<Currency> GetAll(RequestedLanguage requestedLanguage)
 {
     return DeserializeObject<IEnumerable<Currency>>(string.Format("https://api.guildwars2.com/v2/currencies?ids=all&lang={0}", requestedLanguage));
 }
 /// <summary>
 /// Returns the currency that matches the CurrencyType.
 /// </summary>
 /// <param name="currencyType">Represents a known currencies in the wallet.</param>
 /// <param name="requestedLanguage">Represents the language which the API should return.</param>
 /// <returns>Currency object that matches the CurrencyType.</returns>
 public Currency Get(CurrencyType currencyType, RequestedLanguage requestedLanguage)
 {
     return DeserializeObject<Currency>(string.Format("https://api.guildwars2.com/v2/currencies/{0}?lang={1}", (int)currencyType, requestedLanguage));
 }
 /// <summary>
 /// Returns the currency that matches the CurrencyType.
 /// </summary>
 /// <param name="currencyType">Represents a known currencies in the wallet.</param>
 /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
 /// <returns>Currency object that matches the CurrencyType.</returns>
 public Currency GetCurrency(CurrencyType currencyType, RequestedLanguage requestedLanguage = RequestedLanguage.En)
 {
     string jsonString = DownloadJsonString(string.Format("https://api.guildwars2.com/v2/currencies/{0}?lang={1}", (int)currencyType, requestedLanguage));
     return JsonConvert.DeserializeObject<Currency>(jsonString);
 }
 /// <summary>
 /// Returns colors in pagesize.
 /// </summary>
 /// <param name="page">Page number.</param>
 /// <param name="pageSize">Size of colors on one page.</param>
 /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
 /// <returns>Color object on the given page.</returns>
 public IEnumerable <Color> GetByPage(int page, int pageSize, RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <IEnumerable <Color> >(string.Format("https://api.guildwars2.com/v2/colors?page={0}&page_size={1}&lang={2}", page, pageSize, requestedLanguage)));
 }
 /// <summary>
 /// Returns a wrapper for all currency endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public CurrencyWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// A wrapper for all color endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public ColorWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Get an match using its id
 /// </summary>
 /// <param name="worldId">The id of the match</param>
 /// <param name="requestedLanguage">The language to display the results in</param>
 /// <returns>An match containing the results</returns>
 public Matches GetByWorldId(int worldId, RequestedLanguage requestedLanguage = RequestedLanguage.En)
 {
     return DeserializeObject<Matches>(string.Format("https://api.guildwars2.com/v2/wvw/matches?world={0}&lang={1}", worldId, requestedLanguage));
 }
 /// <summary>
 /// Gets all.
 /// </summary>
 /// <param name="requestedLanguage">The requested language.</param>
 /// <returns></returns>
 public IEnumerable<Continent> GetAll(RequestedLanguage requestedLanguage = RequestedLanguage.En)
 {
     return DeserializeObject<IEnumerable<Continent>>(string.Format("https://api.guildwars2.com/v2/continents?ids=all&lang={0}", requestedLanguage));
 }
Exemple #47
0
 /// <summary>
 /// Returns the item that matches with the id.
 /// </summary>
 /// <param name="id">The item id.</param>
 /// <param name="requestedLanguage">Request localized information.</param>
 /// <returns>Item that matches with the id.</returns>
 public Item GetById(int id, RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <Item>(string.Format("https://api.guildwars2.com/v2/items/{0}?lang={1}", id, requestedLanguage)));
 }
 /// <summary>
 /// Gets the by identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="requestedLanguage">The requested language.</param>
 /// <returns></returns>
 public Continent GetById(int id, RequestedLanguage requestedLanguage = RequestedLanguage.En)
 {
     Continent continent = DeserializeObject<Continent>(string.Format("https://api.guildwars2.com/v2/continents?id={0}&lang={1}", id, requestedLanguage));
     continent.Language = requestedLanguage;
     return continent;
 }
 /// <summary>
 /// Returns a wrapper for all map endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public MapWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Returns a wrapper for all the wvw matches endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public MatchesWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Returns one map that matches the id.
 /// </summary>
 /// <param name="mapId">The id of the map.</param>
 /// <param name="requestedLanguage">Language in which the API should be called.</param>
 /// <returns>Returns map that matches the id.</returns>
 public Map GetById(int mapId, RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <Map>(string.Format("https://api.guildwars2.com/v2/maps/{0}?lang={1}", mapId, requestedLanguage)));
 }
 /// <summary>
 /// Get a match using its id
 /// </summary>
 /// <param name="id">The id of the match</param>
 /// <param name="requestedLanguage">The language to display the results in</param>
 /// <returns>A match containing the results</returns>
 public Matches GetById(string id, RequestedLanguage requestedLanguage)
 {
     return DeserializeObject<Matches>(string.Format("https://api.guildwars2.com/v2/wvw/matches?id={0}&lang={1}", id, requestedLanguage));
 }
 /// <summary>
 /// Returns achievement that matches the id.
 /// </summary>
 /// <param name="id">The achievement id.</param>
 /// <param name="requestedLanguage">Language in which the object should be.</param>
 /// <returns>Achievment that matches the id.</returns>
 public Achievement Get(int id, RequestedLanguage requestedLanguage)
 {
     return(DeserializeObject <Achievement>(string.Format("https://api.guildwars2.com/v2/achievements?id={0}&lang={1}", id, requestedLanguage)));
 }
 /// <summary>
 /// Returns a wrapper for all the item endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public ItemWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Returns all achievements that match the ids.
 /// </summary>
 /// <param name="requestedLanguage">Language in which the object should be.</param>
 /// <param name="ids">The achievement ids.</param>
 /// <returns>Achievements that match the ids.</returns>
 public Dictionary <int, Lazy <Achievement> > GetMultiple(RequestedLanguage requestedLanguage, params int[] ids)
 {
     return(InitLazyAchievements(requestedLanguage, ids));
 }
Exemple #56
0
        public void ShouldReturnSpicific(string mapName, string regionName, string continentName, RequestedLanguage language)
        {
            Map map = GW2Api.V2().Maps.GetById(50, language);

            Assert.AreEqual(50, map.Id);
            Assert.AreEqual(continentName, map.ContinentName);
            Assert.AreEqual(15232, map.ContinentRectangle.X.X);
            Assert.AreEqual(14336, map.ContinentRectangle.X.Y);
            Assert.AreEqual(17664, map.ContinentRectangle.Y.X);
            Assert.AreEqual(15872, map.ContinentRectangle.Y.Y);
            Assert.AreEqual(1, map.DefaultFloor);
            Assert.AreEqual(new List <int> {
                0, 1, 2
            }, map.Floors);
            Assert.AreEqual(-27648, map.MapRectangle.X.X);
            Assert.AreEqual(-18432, map.MapRectangle.X.Y);
            Assert.AreEqual(30720, map.MapRectangle.Y.X);
            Assert.AreEqual(18432, map.MapRectangle.Y.Y);
            Assert.AreEqual(80, map.MaxLevel);
            Assert.AreEqual(0, map.MinLevel);
            Assert.AreEqual(mapName, map.Name);
            Assert.AreEqual(4, map.RegionId);
            Assert.AreEqual(regionName, map.RegionName);
        }
 /// <summary>
 /// Returns all currencies.
 /// </summary>
 /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
 /// <returns>All currencies.</returns>
 public IEnumerable<Currency> GetAllCurrencies(RequestedLanguage requestedLanguage = RequestedLanguage.En)
 {
     string jsonString = DownloadJsonString(string.Format("https://api.guildwars2.com/v2/currencies?ids=all&lang={0}", requestedLanguage));
     return JsonConvert.DeserializeObject<IEnumerable<Currency>>(jsonString);
 }
 /// <summary>
 /// Returns the item that matches with the id.
 /// </summary>
 /// <param name="id">The item id.</param>
 /// <param name="requestedLanguage">Request localized information.</param>
 /// <returns>Item that matches with the id.</returns>
 public Item GetById(int id, RequestedLanguage requestedLanguage)
 {
     return DeserializeObject<Item>(string.Format("https://api.guildwars2.com/v2/items/{0}?lang={1}", id, requestedLanguage));
 }
 /// <summary>
 /// Returns a wrapper for all the minis endpoint calls.
 /// </summary>
 /// <param name="language">Represents the language which the API should return.</param>
 public MinisWrapper(RequestedLanguage language)
 {
     this.language = language;
 }
 /// <summary>
 /// Returns colors in pagesize.
 /// </summary>
 /// <param name="page">Page number.</param>
 /// <param name="pageSize">Size of colors on one page.</param>
 /// <param name="requestedLanguage">Represents the language which the API should return. Default english.</param>
 /// <returns>Color object on the given page.</returns>
 public IEnumerable<Color> GetByPage(int page, int pageSize, RequestedLanguage requestedLanguage)
 {
     return DeserializeObject<IEnumerable<Color>>(string.Format("https://api.guildwars2.com/v2/colors?page={0}&page_size={1}&lang={2}", page, pageSize, requestedLanguage));
 }