/// <summary> /// Pulls complete match history, but less detailed data. Includes match Id, start time /// </summary> /// <param name="gamerTag">Activision Id or gamerTag string</param> /// <param name="startTime">Starting time period to look up in unix time milliseconds</param> /// <param name="endTime">Ending time period to look up in unix time milliseconds</param> /// <param name="version">API version to use</param> /// <param name="platform">Platform the user id is on</param> /// <returns>Returns deserialized JObject</returns> /// <exception cref="Exception"> /// Thrown when date is not at least 13 digits, or greater than current unix dates digits in milliseconds /// </exception> public async Task <JObject> GetPlayerMatchDataForByUnixMillisecondsDateWarzoneFullAsync(string gamerTag, string startTime, string endTime, Enums.Version version, Platform platform) { if (gamerTag == null || gamerTag.Trim() == "") { return(null); } var unixEpochNow = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); if (startTime.Length < 13 && endTime.Length > unixEpochNow.ToString().Length || endTime.Length < 13 && endTime.Length > unixEpochNow.ToString().Length) { throw new Exception($"startTime must be unix time in milliseconds. Check your inputs for the correct number of digits: Current unix time in miliseconds is {unixEpochNow} with {unixEpochNow.ToString().Length} digits. If you want to access last 20 default use GetPlayerMatchDataForWarzoneFullAsync()"); } var platformString = EnumSwitch.SwitchPlatform(platform); var versionString = EnumSwitch.SwitchVersion(version); var lookupType = "gamer"; //if (platform == Platform.Uno) //{ // lookupType = "id"; //} var trimmedGamerTag = gamerTag.Trim(); var urlEncodedUsername = HttpUtility.UrlEncode(trimmedGamerTag); string getPlayerUrl = $"https://my.callofduty.com/api/papi-client/crm/cod/{versionString}/title/mw/platform/{platformString}/{lookupType}/{urlEncodedUsername}/matches/wz/start/{startTime}/end/{endTime}"; var json = await MakeRequestAndReturnJsonOrNull(getPlayerUrl); return(json); }
public async Task <JObject> GetMatchDataPerMatchId(string matchId, Platform platform) { if (matchId == null || matchId.Trim() == "") { return(null); } var platformString = EnumSwitch.SwitchPlatform(platform); string getPlayerUrl = $"https://my.callofduty.com/api/papi-client/crm/cod/v2/title/mw/platform/{platformString}/fullMatch/wz/{matchId}/en";; var json = await MakeRequestAndReturnJsonOrNull(getPlayerUrl); return(json); }
///<summary> ///Pulls recent 20 matches with summary data ///</summary> ///<returns> ///Returns deserialized JObject containing match data and summary info /// </returns> public async Task <JObject> GetLast20PlayerMatchDataForWarzoneAsync(string gamerTag, Enums.Version version, Platform platform) { if (gamerTag == null || gamerTag.Trim() == "") { return(null); } var platformString = EnumSwitch.SwitchPlatform(platform); var versionString = EnumSwitch.SwitchVersion(version); var trimmedGamerTag = gamerTag.Trim(); var urlEncodedUsername = HttpUtility.UrlEncode(trimmedGamerTag); string getPlayerUrl = $"https://my.callofduty.com/api/papi-client/crm/cod/{versionString}/title/mw/platform/{platformString}/gamer/{urlEncodedUsername}/matches/wz/start/0/end/0/details"; var json = await MakeRequestAndReturnJsonOrNull(getPlayerUrl); return(json); }
/// <summary> /// Pulls complete match history, but less detailed data. Includes match Id, start time /// </summary> /// <param name="gamerTag">Activision Id or gamerTag string</param> /// <param name="version">API version to use</param> /// <param name="platform">Platform the user id is on</param> /// <returns>Returns deserialized JObject</returns> public async Task <JObject> GetPlayerMatchDataForWarzoneFullAsync(string gamerTag, string startTime, string endTime, Enums.Version version, Platform platform) { if (gamerTag == null || gamerTag.Trim() == "") { return(null); } var platformString = EnumSwitch.SwitchPlatform(platform); var versionString = EnumSwitch.SwitchVersion(version); var lookupType = "gamer"; //if (platform == Platform.Uno) //{ // lookupType = "id"; //} var trimmedGamerTag = gamerTag.Trim(); var urlEncodedUsername = HttpUtility.UrlEncode(trimmedGamerTag); string getPlayerUrl = $"https://my.callofduty.com/api/papi-client/crm/cod/{versionString}/title/mw/platform/{platformString}/{lookupType}/{urlEncodedUsername}/matches/wz/start/0/end/0"; var json = await MakeRequestAndReturnJsonOrNull(getPlayerUrl); return(json); }