public Task <EveServiceResponse <ServerStatus> > ServerStatusAsync(ResponseMode responseMode = ResponseMode.Normal) { const string MethodPath = "{0}/ServerStatus.xml.aspx"; const string CacheKeyFormat = "ServerStatus"; string cacheKey = CacheKeyFormat.FormatInvariant(); IDictionary <string, string> apiParams = new Dictionary <string, string>(); return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseServerStatusResponse)); }
/// <summary>The conquerable station list async.</summary> /// <param name="responseMode">The response mode.</param> /// <returns>The <see cref="Task" />.</returns> public Task <EveServiceResponse <IEnumerable <ConquerableStation> > > ConquerableStationListAsync( ResponseMode responseMode = ResponseMode.Normal) { const string MethodPath = "{0}/ConquerableStationList.xml.aspx"; const string CacheKeyFormat = "ConquerableStationList"; string cacheKey = CacheKeyFormat.FormatInvariant(); IDictionary <string, string> apiParams = new Dictionary <string, string>(); return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseConquerableStationListResponse)); }
public Task <EveServiceResponse <EveStructure> > GetStructureNameAsync(long locationId) { Uri requestUri; Uri.TryCreate(StructureNameApiLocation + locationId, UriKind.Absolute, out requestUri); var cacheKey = CacheKeyFormat.FormatInvariant(locationId); var resultData = GetCacheEntry <EveStructure>(cacheKey); return(resultData != null && !resultData.IsDirty && resultData.Data.IsSuccess ? ReturnCachedResponse(resultData) : _httpRequestProvider.GetAsync(requestUri).ContinueWith(webTask => ProcessServiceResponse(webTask, cacheKey, 600))); }
/// <summary>The character info async.</summary> /// <param name="characterId">The character id.</param> /// <param name="responseMode">The response Mode.</param> /// <returns>The <see cref="Task" />.</returns> public Task <EveServiceResponse <CharacterInfo> > CharacterInfoAsync(int characterId, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(characterId > 0); const string MethodPath = "{0}/CharacterInfo.xml.aspx"; const string CacheKeyFormat = "Eve_CharacterInfo{0}"; string cacheKey = CacheKeyFormat.FormatInvariant(characterId); IDictionary <string, string> apiParams = new Dictionary <string, string>(); apiParams.Add(ApiConstants.CharacterId, characterId.ToInvariantString()); return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseCharacterInfoResult)); }
/// <summary>The upcoming calendar events.</summary> /// <param name="keyId">The key id.</param> /// <param name="vCode">The v code.</param> /// <param name="characterId">The character id.</param> /// <param name="responseMode">The response Mode.</param> /// <returns>The <see cref="Task" />.</returns> public Task <EveServiceResponse <IEnumerable <UpcomingCalendarEvent> > > UpcomingCalendarEvents(string keyId, string vCode, long characterId, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); Guard.Ensure(characterId > 0); const string MethodPath = "{0}/UpcomingCalendarEvents.xml.aspx"; const string CacheKeyFormat = "UpcomingCalendarEvents{0}_{1}"; string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId); return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), null, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessUpcomingCalendarEventsResponse)); }
/// <summary>Retrieves the Character Sheet data from the Eve web service.</summary> /// <param name="keyId">API Key ID to query</param> /// <param name="vCode">The Verification Code for this ID</param> /// <param name="characterId">Character to query.</param> /// <param name="responseMode">The response Mode.</param> /// <returns>The given character's data.</returns> public Task <EveServiceResponse <CharacterData> > CharacterSheetAsync(string keyId, string vCode, long characterId, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); Guard.Ensure(characterId > 0); const string MethodPath = "/char/CharacterSheet.xml.aspx"; const string CacheKeyFormat = "CharacterSheet{0}_{1}"; string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId); return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), null, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseCharacterSheetResponse)); }
/// <summary>Retrieves the collection of mail message headers from the eve web service</summary> /// <param name="keyId">API Key ID to query</param> /// <param name="vCode">The Verification Code for this ID</param> /// <param name="characterId">Character to query.</param> /// <param name="responseMode">The response Mode.</param> /// <returns>A collection of mail headers </returns> public Task <EveServiceResponse <IEnumerable <MailHeader> > > MailMessagesAsync(string keyId, string vCode, int characterId, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); Guard.Ensure(characterId > 0); const string MethodPath = "{0}/MailMessages.xml.aspx"; const string CacheKeyFormat = "CharacterMailMessages{0}_{1}"; string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId); return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), null, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessMailMessagesResponse)); }
/// <summary>Calls the CalendarEventAttendees method on the Eve web service.</summary> /// <param name="keyId">API Key ID to query</param> /// <param name="vCode">The Verification Code for this ID</param> /// <param name="characterId">Character to query.</param> /// <param name="eventId">The eventID to query</param> /// <param name="responseMode"></param> /// <returns>A collection of attendees for the event.</returns> public Task <EveServiceResponse <IEnumerable <CalendarEventAttendee> > > CalendarEventAttendees(string keyId, string vCode, long characterId, int eventId, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); Guard.Ensure(characterId > 0); const string MethodPath = "{0}/CalendarEventAttendees.xml.aspx"; const string CacheKeyFormat = "Calendar_EventAttendees{0}_{1}_{2}"; string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId, eventId); IDictionary <string, string> apiParams = new Dictionary <string, string>(); apiParams[ApiConstants.EventId] = eventId.ToInvariantString(); return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseCalendarEventAttendeesResponse)); }
/// <summary>The notification texts.</summary> /// <param name="keyId">The key id.</param> /// <param name="vCode">The v code.</param> /// <param name="characterId">The character id.</param> /// <param name="notificationIds">The notification ids.</param> /// <param name="responseMode">The response Mode.</param> /// <returns>The <see cref="Task" />.</returns> public Task <EveServiceResponse <IEnumerable <NotificationText> > > NotificationTextsAsync( string keyId, string vCode, long characterId, IEnumerable <long> notificationIds, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); Guard.Ensure(characterId > 0); const string MethodPath = "{0}/NotificationTexts.xml.aspx"; const string CacheKeyFormat = "NotificationTexts{0}_{1}_{2}"; string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId, notificationIds.GetHashCode()); IDictionary <string, string> apiParams = new Dictionary <string, string>(); apiParams[ApiConstants.Ids] = string.Join(",", notificationIds.Select(id => id.ToInvariantString())); return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessNotificationTextsResponse)); }
public Task <EveServiceResponse <CorporateData> > CorporationSheetAsync(string keyId, string vCode, int corpId = 0, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); const string MethodPath = "{0}/CorporationSheet.xml.aspx"; const string CacheKeyFormat = "CorporationSheet{0}"; string cacheKey = CacheKeyFormat.FormatInvariant(keyId, corpId > 0 ? "_{0}".FormatInvariant(corpId) : string.Empty); IDictionary <string, string> apiParams = new Dictionary <string, string>(); if (corpId > 0) { apiParams["corporationID"] = corpId.ToInvariantString(); } return(GetServiceResponseAsync(keyId, vCode, 0, MethodPath.FormatInvariant(PathPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessCorporationSheetResponse)); }
/// <summary>Retrieves the mail bodies for given IDs</summary> /// <param name="keyId">API Key ID to query</param> /// <param name="vCode">The Verification Code for this ID</param> /// <param name="characterId">Character to query.</param> /// <param name="ids">The id values to get the mail bodies for</param> /// <param name="responseMode">The response Mode.</param> /// <returns>a collection of mail bodies</returns> public Task <EveServiceResponse <IEnumerable <MailBody> > > MailBodiesAsync(string keyId, string vCode, long characterId, IEnumerable <int> ids, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(!keyId.IsNullOrWhiteSpace()); Guard.Ensure(!vCode.IsNullOrWhiteSpace()); Guard.Ensure(characterId > 0); Guard.Ensure(ids != null); Guard.Ensure(ids.Any()); const string MethodPath = "{0}/MailBodies.xml.aspx"; const string CacheKeyFormat = "CharacterMailBodies{0}_{1}_{2}"; // TODO: switch to using a hash value for making a unique key or a long batch of mail ids can cause a filename length issue. string cacheKey = CacheKeyFormat.FormatInvariant(keyId, characterId, string.Join("_", ids.Select(id => id.ToInvariantString())).GetHashCode()); IDictionary <string, string> apiParams = new Dictionary <string, string>(); apiParams[ApiConstants.Ids] = string.Join(",", ids.Select(id => id.ToInvariantString())); return(GetServiceResponseAsync(keyId, vCode, characterId, MethodPath.FormatInvariant(PathPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ProcessMailBodyResponse)); }
/// <summary>The character id async.</summary> /// <param name="names">The names.</param> /// <param name="responseMode">The response Mode.</param> /// <returns>The <see cref="Task" />.</returns> /// <exception cref="ArgumentException"></exception> public Task <EveServiceResponse <IEnumerable <CharacterName> > > CharacterIdAsync(IEnumerable <string> names, ResponseMode responseMode = ResponseMode.Normal) { Guard.Ensure(names != null); List <string> checkedNames = names.Distinct().ToList(); // remove duplicates if (checkedNames.Count > 250 || checkedNames.Count < 1) { throw new ArgumentException("names must have a length of 250 or less and greater than 0."); } const string MethodPath = "{0}/CharacterID.xml.aspx"; const string CacheKeyFormat = "Eve_CharacterID{0}"; const string paramName = "names"; string cacheKey = CacheKeyFormat.FormatInvariant(checkedNames.GetHashCode()); IDictionary <string, string> apiParams = new Dictionary <string, string>(); apiParams.Add(paramName, string.Join(",", checkedNames.Select(name => name))); return(GetServiceResponseAsync(null, null, 0, MethodPath.FormatInvariant(RequestPrefix), apiParams, cacheKey, ApiConstants.SixtyMinuteCache, responseMode, ParseCharacterNameResult)); }