/// <summary> /// Returns stats for the chosen hero (hero id can be seen in Profile Information) /// </summary> /// <param name="region">Player region</param> /// <param name="battleTag">Player's battle tag</param> /// <param name="heroId">Player's hero ID (hero IDs can be fetched from profile information</param> /// <param name="locale">Language code (locale)</param> /// <returns></returns> public static CharacterInfo GetCharacterInfo(RequestParameters.REGIONS region, string battleTag, string heroId, string locale, string apiKeyValue) { using (HttpWebResponse response = RequestHandler.CreateCharacterRequest(region, battleTag, heroId, locale, apiKeyValue)) { if (response.StatusCode != HttpStatusCode.OK) { throw new Exception(String.Format("Server error (HTTP {0}: {1}).", response.StatusCode, response.StatusDescription)); } DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(CharacterInfo)); object objResponse = jsonSerializer.ReadObject(response.GetResponseStream()); CharacterInfo jsonResponse = objResponse as CharacterInfo; return jsonResponse; } }
/// <summary> /// Returns follower information /// </summary> /// <param name="region">Player region</param> /// <param name="follower">Chosen follower</param> /// <param name="locale">Language code (locale)</param> /// <returns></returns> public static FollowerInfo GetFollowerInfo(RequestParameters.REGIONS region, RequestParameters.FOLLOWERS follower, string locale, string apiKeyValue) { using (HttpWebResponse response = RequestHandler.CreateFollowerRequest(region, Enum.GetName(typeof(RequestParameters.FOLLOWERS), follower).ToLower(), locale, apiKeyValue)) { if (response.StatusCode != HttpStatusCode.OK) { throw new Exception(String.Format("Server error (HTTP {0}: {1}).", response.StatusCode, response.StatusDescription)); } DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(FollowerInfo)); object objResponse = jsonSerializer.ReadObject(response.GetResponseStream()); FollowerInfo jsonResponse = objResponse as FollowerInfo; return jsonResponse; } }
public void GetItemInfo(RequestParameters.REGIONS region, string battleTag, string itemString, string apiKeyValue) { }