RiotSharp.RateLimitedRequester.CreateGetRequestAsync C# (CSharp) Метод

CreateGetRequestAsync() публичный Метод

public CreateGetRequestAsync ( string relativeUrl, Region region, List addedArguments = null, bool useHttps = true ) : Task
relativeUrl string
region Region
addedArguments List
useHttps bool
Результат Task
        public async Task<string> CreateGetRequestAsync(string relativeUrl, Region region,
            List<string> addedArguments = null, bool useHttps = true)
        {
            rootDomain = region + ".api.pvp.net";
            var request = PrepareRequest(relativeUrl, addedArguments, useHttps, HttpMethod.Get);

            await semaphore.WaitAsync();
            {
                HandleRateLimit(region);
            }
            semaphore.Release();

            return await GetResultAsync(request);
        }

Usage Example

Пример #1
0
        /// <summary>
        ///     Returns the details of a certain tournament code.
        /// </summary>
        /// <param name="tournamentCode">The tournament code in string format.</param>
        /// <returns>TournamentCodeDetail object with details of the tournament code.</returns>
        public async Task <TournamentCodeDetail> GetTournamentCodeDetailsAsync(string tournamentCode)
        {
            var json =
                await
                requester.CreateGetRequestAsync(TournamentRootUrl + string.Format(GetCodeUrl, tournamentCode),
                                                Region.global);

            return(await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <TournamentCodeDetail>(json)));
        }