示例#1
0
        public async Task <PagedModel <V2BookmarksCharacter> > CharacterBookmarksAsync(SsoToken token, int page)
        {
            StaticMethods.CheckToken(token, BookmarkScopes.esi_bookmarks_read_character_bookmarks_v1);

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

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

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

            IList <V2BookmarksCharacter> mapped = _mapper.Map <IList <EsiV2BookmarksCharacter>, IList <V2BookmarksCharacter> >(esiModel);

            return(new PagedModel <V2BookmarksCharacter> {
                Model = mapped, MaxPages = esiRaw.MaxPages, CurrentPage = page
            });
        }