示例#1
0
        public async Task <T> GetAsync <T>(string relativeUrl, BlizzardLocaleFlags locale = BlizzardLocaleFlags.EnglishUS, BlizzardNamespace ns = BlizzardNamespace.Dynamic)
        {
            var uri = BlizzardUrlBuilder.GetUrl(Region, relativeUrl, locale, ns);

            var response = await client.GetAsync(uri, token);

#if DEBUG
            var stringValue = await response.Content.ReadAsStringAsync();
#endif

            await using var stream = await response.Content.ReadAsStreamAsync();

            return(await JsonSerializer.DeserializeAsync <T>(stream, deserializeOptions, token));
        }
示例#2
0
        public async Task <string> GetJsonAsync(string relativeUrl, BlizzardLocaleFlags locale = BlizzardLocaleFlags.EnglishUS, BlizzardNamespace ns = BlizzardNamespace.Dynamic)
        {
            var uri = BlizzardUrlBuilder.GetUrl(Region, relativeUrl, locale, ns);

            return(await client.GetStringAsync(uri));
        }