private Dictionary <string, object> BuildTournamentUpdateBody(List <long> allowedSummonerIds, TournamentSpectatorType?spectatorType, TournamentPickType?pickType, TournamentMapType?mapType) { var body = new Dictionary <string, object>(); if (allowedSummonerIds != null) { body.Add("allowedParticipants", string.Join(",", allowedSummonerIds)); } if (spectatorType != null) { body.Add("spectatorType", spectatorType); } if (pickType != null) { body.Add("pickType", pickType); } if (mapType != null) { body.Add("mapType", mapType); } return(body); }
/// <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 async Task <bool> UpdateTournamentCodeAsync(string tournamentCode, List <long> allowedSummonerIds, TournamentSpectatorType?spectatorType, TournamentPickType?pickType, TournamentMapType?mapType) { var body = BuildTournamentUpdateBody(allowedSummonerIds, spectatorType, pickType, mapType); return(await requester.CreatePutRequestAsync(TournamentRootUrl + string.Format(PutCodeUrl, tournamentCode), Region.global, JsonConvert.SerializeObject(body))); }
/// <summary> /// Update the pick type, map, spectator type, or allowed summoners for a code asynchronously. /// </summary> /// <param name="allowedSummonerIds">Comma separated list of summoner Ids.</param> /// <param name="spectatorType">The spectator type.</param> /// <param name="pickType">The pick type.</param> /// <param name="mapType">The map type.</param> public async Task <bool> UpdateAsync(List <long> allowedSummonerIds, TournamentSpectatorType?spectatorType, TournamentPickType?pickType, TournamentMapType?mapType) { return(await TournamentRiotApi.GetInstance() .UpdateTournamentCodeAsync(Code, allowedSummonerIds, spectatorType, pickType, mapType)); }
/// <inheritdoc /> public Task <bool> UpdateTournamentCodeAsync(string tournamentCode, List <long> allowedParticipantIds = null, TournamentSpectatorType?spectatorType = null, TournamentPickType?pickType = null, TournamentMapType?mapType = null) { var body = BuildTournamentUpdateBody(allowedParticipantIds, spectatorType, pickType, mapType); return(_requester.CreatePutRequestAsync(_tournamentRootUrl + string.Format(PutCodeUrl, tournamentCode), Region.Americas, JsonConvert.SerializeObject(body))); }
/// <summary> /// Update the pick type, map, spectator type, or allowed summoners for a code. /// </summary> /// <param name="allowedSummonerIds">Comma separated list of summoner Ids.</param> /// <param name="spectatorType">The spectator type.</param> /// <param name="pickType">The pick type.</param> /// <param name="mapType">The map type.</param> public bool Update(List <long> allowedSummonerIds, TournamentSpectatorType?spectatorType, TournamentPickType?pickType, TournamentMapType?mapType) { return(TournamentRiotApi.GetInstance() .UpdateTournamentCode(Code, allowedSummonerIds, spectatorType, pickType, mapType)); }