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

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

public CreatePutRequest ( string relativeUrl, Region region, string body, List addedArguments = null, bool useHttps = true ) : bool
relativeUrl string
region Region
body string
addedArguments List
useHttps bool
Результат bool
        public bool CreatePutRequest(string relativeUrl, Region region, string body, List<string> addedArguments = null,
            bool useHttps = true)
        {
            rootDomain = region + ".api.pvp.net";
            var request = PrepareRequest(relativeUrl, addedArguments, useHttps, HttpMethod.Put);
            request.Content = new StringContent(body, Encoding.UTF8, "application/json");

            semaphore.Wait();
            {
                HandleRateLimit(region);
            }
            semaphore.Release();

            var response = Put(request);
            return (int)response.StatusCode >= 200 && (int)response.StatusCode < 300;
        }

Usage Example

Пример #1
0
        /// <summary>
        ///     Update the pick type, map, spectator type, or allowed summoners for a code.
        /// </summary>
        /// <param name="tournamentCode">The tournament code to update</param>
        /// <param name="allowedSummonerIds">List of summoner id's.</param>
        /// <param name="spectatorType">The spectator type.</param>
        /// <param name="pickType">The pick type.</param>
        /// <param name="mapType">The map type.</param>
        /// <returns>Success value.</returns>
        public bool UpdateTournamentCode(string tournamentCode, List <long> allowedSummonerIds,
                                         TournamentSpectatorType?spectatorType, TournamentPickType?pickType, TournamentMapType?mapType)
        {
            var body = BuildTournamentUpdateBody(allowedSummonerIds, spectatorType, pickType, mapType);

            return(requester.CreatePutRequest(TournamentRootUrl + string.Format(PutCodeUrl, tournamentCode), Region.global,
                                              JsonConvert.SerializeObject(body)));
        }