Пример #1
0
        public async Task <string> DeleteAsync(WebHeaderCollection headers, string address, string data)
        {
            System.Net.WebClient client = new System.Net.WebClient
            {
                Headers     = headers,
                CachePolicy = new HttpRequestCachePolicy()
            };

            client.Headers["UserAgent"] = _userAgent;

            try
            {
                return(await client.UploadStringTaskAsync(address, "DELETE", data));
            }
            catch (WebException e)
            {
                EsiModel returned = BuildException(e, null, null, address, data);

                if (returned != null)
                {
                    return(string.Empty);
                }

                throw;
            }
        }
        public async Task <IList <int> > WarsAsync(int maxWarId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.WarsV1Wars(maxWarId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            return(JsonConvert.DeserializeObject <IList <int> >(esiRaw.Model));
        }
Пример #3
0
        public IList <long> Structures()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.UniverseV1Structures(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 3600));

            return(JsonConvert.DeserializeObject <IList <long> >(esiRaw.Model));
        }
Пример #4
0
        public async Task <IList <int> > GroupsAsync()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.OpportunitiesV1Groups(), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            return(JsonConvert.DeserializeObject <IList <int> >(esiRaw.Model));
        }
Пример #5
0
        public IList <int> Tasks()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.OpportunitiesV1Tasks(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            return(JsonConvert.DeserializeObject <IList <int> >(esiRaw.Model));
        }
Пример #6
0
        public IList <int> Alliances()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.AllianceV1Alliance(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 3600));

            IList <int> esiActiveAlliances = JsonConvert.DeserializeObject <IList <int> >(esiRaw.Model);

            return(esiActiveAlliances);
        }
        public async Task <IList <V1WarsKillmail> > KillmailsAsync(int warId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.WarsV1WarKillmails(warId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            IList <EsiV1WarsKillmail> esiWar = JsonConvert.DeserializeObject <IList <EsiV1WarsKillmail> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1WarsKillmail>, IList <V1WarsKillmail> >(esiWar));
        }
Пример #8
0
        public async Task <double> CharacterAsync(SsoToken token)
        {
            StaticMethods.CheckToken(token, WalletScopes.esi_wallet_read_character_wallet_v1);

            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.WalletV1CharactersWallet(token.CharacterId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(token), url, 120));

            return(JsonConvert.DeserializeObject <double>(esiRaw.Model));
        }
Пример #9
0
        public V1AllianceIcons Icons(int allianceId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.AllianceV1Icons(allianceId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 3600));

            EsiV1AllianceIcons esiAllianceIcons = JsonConvert.DeserializeObject <EsiV1AllianceIcons>(esiRaw.Model);

            return(_mapper.Map <EsiV1AllianceIcons, V1AllianceIcons>(esiAllianceIcons));
        }
        public async Task <IList <V1CharactersCorporationHistory> > CorporationHistoryAsync(int characterId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.EsiV1CharactersCorporationHistory(characterId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            IList <EsiV1CharactersCorporationHistory> esiV1CharactersCorporationHistory = JsonConvert.DeserializeObject <IList <EsiV1CharactersCorporationHistory> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1CharactersCorporationHistory>, IList <V1CharactersCorporationHistory> >(esiV1CharactersCorporationHistory));
        }
        public async Task <V2CharactersPortrait> PortraitAsync(int characterId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.EsiV2CharactersPortrait(characterId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            EsiV2CharactersPortrait esiV2CharactersPortrait = JsonConvert.DeserializeObject <EsiV2CharactersPortrait>(esiRaw.Model);

            return(_mapper.Map <EsiV2CharactersPortrait, V2CharactersPortrait>(esiV2CharactersPortrait));
        }
Пример #12
0
        public IList <V1UniverseBloodlines> Bloodlines()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.UniverseV1Bloodlines(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            IList <EsiV1UniverseBloodlines> esiModel = JsonConvert.DeserializeObject <IList <EsiV1UniverseBloodlines> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1UniverseBloodlines>, IList <V1UniverseBloodlines> >(esiModel));
        }
Пример #13
0
        public async Task <V1KillmailKillmail> KillmailAsync(int killmailId, string killmailHash)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.KillmailsV1Killmail(killmailId, killmailHash), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 1209600));

            EsiV1KillmailKillmail esiModel = JsonConvert.DeserializeObject <EsiV1KillmailKillmail>(esiRaw.Model);

            return(_mapper.Map <EsiV1KillmailKillmail, V1KillmailKillmail>(esiModel));
        }
Пример #14
0
        public async Task <V3UniverseType> TypeAsync(int typeId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.UniverseV3Type(typeId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV3UniverseType esiModel = JsonConvert.DeserializeObject <EsiV3UniverseType>(esiRaw.Model);

            return(_mapper.Map <EsiV3UniverseType, V3UniverseType>(esiModel));
        }
Пример #15
0
        public V1UniverseAsteroidBelt AsteroidBelt(int asteroidBelId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.UniverseV1AsteroidBelt(asteroidBelId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV1UniverseAsteroidBelt esiModel = JsonConvert.DeserializeObject <EsiV1UniverseAsteroidBelt>(esiRaw.Model);

            return(_mapper.Map <V1UniverseAsteroidBelt>(esiModel));
        }
Пример #16
0
        public V4UniverseSystem System(int systemId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.UniverseV4System(systemId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV4UniverseSystem esiModel = JsonConvert.DeserializeObject <EsiV4UniverseSystem>(esiRaw.Model);

            return(_mapper.Map <EsiV4UniverseSystem, V4UniverseSystem>(esiModel));
        }
Пример #17
0
        public async Task <V3AlliancePublicInfo> PublicInfoAsync(int allianceId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.AllianceV3PublicInfo(allianceId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            EsiV3AlliancePublicInfo esiPublicInfo = JsonConvert.DeserializeObject <EsiV3AlliancePublicInfo>(esiRaw.Model);

            return(_mapper.Map <EsiV3AlliancePublicInfo, V3AlliancePublicInfo>(esiPublicInfo));
        }
        public V4CharactersPublicInfo PublicInfo(int characterId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.EsiV4CharactersPublicInfo(characterId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 3600));

            EsiV4CharactersPublicInfo esiV4PublicInfo = JsonConvert.DeserializeObject <EsiV4CharactersPublicInfo>(esiRaw.Model);

            return(_mapper.Map <EsiV4CharactersPublicInfo, V4CharactersPublicInfo>(esiV4PublicInfo));
        }
Пример #19
0
        public async Task <IList <int> > CorporationsAsync(int allianceId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.AllianceV1Corporations(allianceId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 3600));

            IList <int> esiAllianceCorporations = JsonConvert.DeserializeObject <IList <int> >(esiRaw.Model);

            return(esiAllianceCorporations);
        }
Пример #20
0
        public IList <V1SovereigntyMap> Map()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.SovereigntyV1Map(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 3600));

            IList <EsiV1SovereigntyMap> esiModel = JsonConvert.DeserializeObject <IList <EsiV1SovereigntyMap> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1SovereigntyMap>, IList <V1SovereigntyMap> >(esiModel));
        }
        public async Task <IList <V1LoyaltyOffer> > OffersAsync(int corporationId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.LoyaltyV1Offers(corporationId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            IList <EsiV1LoyaltyOffer> model = JsonConvert.DeserializeObject <IList <EsiV1LoyaltyOffer> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1LoyaltyOffer>, IList <V1LoyaltyOffer> >(model));
        }
Пример #22
0
        public async Task <IList <V1SovereigntyStructures> > StructuresAsync()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.SovereigntyV1Structures(), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, 120));

            IList <EsiV1SovereigntyStructures> esiModel = JsonConvert.DeserializeObject <IList <EsiV1SovereigntyStructures> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1SovereigntyStructures>, IList <V1SovereigntyStructures> >(esiModel));
        }
Пример #23
0
        public async Task <V1OpportunitiesTask> TaskAsync(int taskId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.OpportunitiesV1Task(taskId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV1OpportunitiesTask esiModel = JsonConvert.DeserializeObject <EsiV1OpportunitiesTask>(esiRaw.Model);

            return(_mapper.Map <V1OpportunitiesTask>(esiModel));
        }
        public async Task <IList <V1FwWars> > WarsAsync()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.FactionWarfareV1Wars(), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            IList <EsiV1FwWars> esiModel = JsonConvert.DeserializeObject <IList <EsiV1FwWars> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV1FwWars>, IList <V1FwWars> >(esiModel));
        }
Пример #25
0
        public V1OpportunitiesGroup Group(int groupId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.OpportunitiesV1Group(groupId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV1OpportunitiesGroup esiModel = JsonConvert.DeserializeObject <EsiV1OpportunitiesGroup>(esiRaw.Model);

            return(_mapper.Map <V1OpportunitiesGroup>(esiModel));
        }
Пример #26
0
        public V1DogmaAttribute Attribute(int attributeId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.DogmaV1Attribute(attributeId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV1DogmaAttribute esiModel = JsonConvert.DeserializeObject <EsiV1DogmaAttribute>(esiRaw.Model);

            return(_mapper.Map <EsiV1DogmaAttribute, V1DogmaAttribute>(esiModel));
        }
        public IList <V2FwSystems> Systems()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.FactionWarfareV2Systems(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 1800));

            IList <EsiV2FwSystems> esiModel = JsonConvert.DeserializeObject <IList <EsiV2FwSystems> >(esiRaw.Model);

            return(_mapper.Map <IList <EsiV2FwSystems>, IList <V2FwSystems> >(esiModel));
        }
Пример #28
0
        public async Task <V1DogmaDynamicItem> DynamicItemAsync(int typeId, long itemId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.DogmaV1DynamicItem(typeId, itemId), _testing);

            EsiModel esiRaw = await PollyPolicies.WebExceptionRetryWithFallbackAsync.ExecuteAsync(async() => await _webClient.GetAsync(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV1DogmaDynamicItem esiModel = JsonConvert.DeserializeObject <EsiV1DogmaDynamicItem>(esiRaw.Model);

            return(_mapper.Map <EsiV1DogmaDynamicItem, V1DogmaDynamicItem>(esiModel));
        }
        public V1FwFactionLeaderboard FactionLeaderboard()
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.FactionWarfareV1FactionLeaderboard(), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, SecondsToDT()));

            EsiV1FwFactionLeaderboard esiModel = JsonConvert.DeserializeObject <EsiV1FwFactionLeaderboard>(esiRaw.Model);

            return(_mapper.Map <EsiV1FwFactionLeaderboard, V1FwFactionLeaderboard>(esiModel));
        }
        public V1WarsWar War(int warId)
        {
            string url = StaticConnectionStrings.CheckTestingUrl(StaticConnectionStrings.WarsV1War(warId), _testing);

            EsiModel esiRaw = PollyPolicies.WebExceptionRetryWithFallback.Execute(() => _webClient.Get(StaticMethods.CreateHeaders(), url, 3600));

            EsiV1WarsWar war = JsonConvert.DeserializeObject <EsiV1WarsWar>(esiRaw.Model);

            return(_mapper.Map <V1WarsWar>(war));
        }