示例#1
0
 /// <summary>
 ///     Create a tournament code for the tournament asynchronously.
 /// </summary>
 /// <param name="teamSize">The team size for the tournament code game.</param>
 /// <param name="allowedSummonerIds">participants</param>
 /// <param name="spectatorType">The spectator mode for the tournament code game.</param>
 /// <param name="pickType">The pick mode for tournament code game.</param>
 /// <param name="mapType">The game map for the tournament code game</param>
 /// <param name="metadata">The metadata for tournament code.</param>
 /// <returns>The tournament code.</returns>
 public async Task<string> CreateTournamentCodeAsync(int teamSize, List<long> allowedSummonerIds,
     TournamentSpectatorType spectatorType, TournamentPickType pickType, TournamentMapType mapType,
     string metadata)
 {
     return await TournamentRiotApi.GetInstance()
         .CreateTournamentCodeAsync(Id, teamSize, allowedSummonerIds, spectatorType, pickType, mapType, metadata);
 }
示例#2
0
        /// <summary>
        ///     Create a tournament code for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="allowedSummonerIds">
        ///     Optional list of participants in order to validate the players eligible to join the
        ///     lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and
        ///     teamTwo. We may add the ability to enforce at the team level in the future.
        /// </param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <returns>The tournament code in string format.</returns>
        public async Task <string> CreateTournamentCodeAsync(int tournamentId, int teamSize,
                                                             List <long> allowedSummonerIds, TournamentSpectatorType spectatorType, TournamentPickType pickType,
                                                             TournamentMapType mapType, string metadata)
        {
            var body = new Dictionary <string, object>
            {
                { "teamSize", teamSize },
                { "allowedSummonerIds", new Dictionary <string, object> {
                      { "participants", allowedSummonerIds }
                  } },
                { "spectatorType", spectatorType },
                { "pickType", pickType },
                { "mapType", mapType },
                { "metadata", metadata }
            };
            var json =
                await
                requester.CreatePostRequestAsync(TournamentRootUrl + CreateCodeUrl, Region.global,
                                                 JsonConvert.SerializeObject(body),
                                                 new List <string>
            {
                string.Format("tournamentId={0}", tournamentId),
                string.Format("count={0}", 1)
            });

            return(await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <List <string> >(json).FirstOrDefault()));
        }
        /// <inheritdoc />
        /// <exception cref="T:System.ArgumentException">Thrown if an invalid <paramref name="teamSize" /> or an invalid <paramref name="count" /> is provided.</exception>
        public async Task <List <string> > CreateTournamentCodesAsync(int tournamentId, int count, int teamSize,
                                                                      TournamentSpectatorType spectatorType, TournamentPickType pickType,
                                                                      TournamentMapType mapType, List <long> allowedParticipantIds = null, string metadata = null)
        {
            ValidateTeamSize(teamSize);
            ValidateTournamentCodeCount(count);
            var body = new Dictionary <string, object>
            {
                { "teamSize", teamSize },
                { "allowedSummonerIds", allowedParticipantIds },
                { "spectatorType", spectatorType },
                { "pickType", pickType },
                { "mapType", mapType },
                { "metadata", metadata }
            };
            var json = await _requester.CreatePostRequestAsync(_tournamentRootUrl + CreateCodesUrl, Region.Americas,
                                                               JsonConvert.SerializeObject(body, null,
                                                                                           new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            }),
                                                               new List <string>
            {
                $"tournamentId={tournamentId}",
                $"count={count}"
            }).ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <List <string> >(json));
        }
示例#4
0
        /// <summary>
        ///     Create multiple tournament codes for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <param name="count">The number of codes to create (max 1000).</param>
        /// <returns>A list of tournament codes in string format.</returns>
        public List <string> CreateTournamentCodes(int tournamentId, int teamSize, TournamentSpectatorType spectatorType,
                                                   TournamentPickType pickType, TournamentMapType mapType, string metadata, int count = 1)
        {
            var body = new Dictionary <string, object>
            {
                { "teamSize", teamSize },
                { "spectatorType", spectatorType },
                { "pickType", pickType },
                { "mapType", mapType },
                { "metadata", metadata }
            };
            var json = requester.CreatePostRequest(TournamentRootUrl + CreateCodeUrl, Region.global,
                                                   JsonConvert.SerializeObject(body),
                                                   new List <string> {
                string.Format("tournamentId={0}", tournamentId), string.Format("count={0}", count)
            });

            // json is a list of strings
            var tournamentCodes = JsonConvert.DeserializeObject <List <string> >(json);

            return(tournamentCodes);
        }
示例#5
0
        /// <summary>
        ///     Create multiple tournament codes for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <param name="count">The number of codes to create (max 1000).</param>
        /// <returns>A list of tournament codes in string format.</returns>
        public async Task <List <string> > CreateTournamentCodesAsync(int tournamentId, int teamSize,
                                                                      TournamentSpectatorType spectatorType, TournamentPickType pickType, TournamentMapType mapType,
                                                                      string metadata, int count = 1)
        {
            var body = new Dictionary <string, object>
            {
                { "teamSize", teamSize },
                { "spectatorType", spectatorType },
                { "pickType", pickType },
                { "mapType", mapType },
                { "metadata", metadata }
            };
            var json =
                await
                requester.CreatePostRequestAsync(TournamentRootUrl + CreateCodeUrl, Region.global,
                                                 JsonConvert.SerializeObject(body),
                                                 new List <string>
            {
                string.Format("tournamentId={0}", tournamentId),
                string.Format("count={0}", count)
            });

            return(await Task.Factory.StartNew(() => JsonConvert.DeserializeObject <List <string> >(json)));
        }
示例#6
0
        /// <summary>
        ///     Create a tournament code for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="allowedSummonerIds">
        ///     Optional list of participants in order to validate the players eligible to join the
        ///     lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and
        ///     teamTwo. We may add the ability to enforce at the team level in the future.
        /// </param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <returns>The tournament code in string format.</returns>
        public string CreateTournamentCode(int tournamentId, int teamSize, List <long> allowedSummonerIds,
                                           TournamentSpectatorType spectatorType, TournamentPickType pickType, TournamentMapType mapType,
                                           string metadata)
        {
            var body = new Dictionary <string, object>
            {
                { "teamSize", teamSize },
                { "allowedSummonerIds", new Dictionary <string, object> {
                      { "participants", allowedSummonerIds }
                  } },
                { "spectatorType", spectatorType },
                { "pickType", pickType },
                { "mapType", mapType },
                { "metadata", metadata }
            };
            var json = requester.CreatePostRequest(TournamentRootUrl + CreateCodeUrl, Region.global,
                                                   JsonConvert.SerializeObject(body),
                                                   new List <string> {
                string.Format("tournamentId={0}", tournamentId), string.Format("count={0}", 1)
            });

            // json is a list of strings
            var tournamentCodes = JsonConvert.DeserializeObject <List <string> >(json);

            return(tournamentCodes.FirstOrDefault());
        }
 /// <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);
 }
示例#8
0
        /// <summary>
        ///     Create a tournament code for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="allowedSummonerIds">
        ///     Optional list of participants in order to validate the players eligible to join the
        ///     lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and
        ///     teamTwo. We may add the ability to enforce at the team level in the future.
        /// </param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <returns>The tournament code in string format.</returns>
        public async Task<string> CreateTournamentCodeAsync(int tournamentId, int teamSize,
            List<long> allowedSummonerIds, TournamentSpectatorType spectatorType, TournamentPickType pickType,
            TournamentMapType mapType, string metadata)
        {
            var body = new Dictionary<string, object>
            {
                {"teamSize", teamSize},
                {"allowedSummonerIds", new Dictionary<string, object> {{"participants", allowedSummonerIds}}},
                {"spectatorType", spectatorType},
                {"pickType", pickType},
                {"mapType", mapType},
                {"metadata", metadata}
            };
            var json =
                await
                    requester.CreatePostRequestAsync(TournamentRootUrl + CreateCodeUrl, Region.global,
                        JsonConvert.SerializeObject(body),
                        new List<string>
                        {
                            string.Format("tournamentId={0}", tournamentId),
                            string.Format("count={0}", 1)
                        });

            return await Task.Factory.StartNew(() => JsonConvert.DeserializeObject<List<string>>(json).FirstOrDefault());
        }
示例#9
0
 /// <summary>
 ///     Create multiple tournament codes for the tournament asynchronously.
 /// </summary>
 /// <param name="teamSize">The team size for the tournament code game.</param>
 /// <param name="spectatorType">The spectator mode for the tournament code game.</param>
 /// <param name="pickType">The pick mode for tournament code game.</param>
 /// <param name="mapType">The game map for the tournament code game</param>
 /// <param name="metadata">The metadata for tournament code.</param>
 /// <param name="count">The number of codes to be created</param>
 /// <returns>A list of the created tournament codes</returns>
 public async Task<List<string>> CreateTournamentCodesAsync(int teamSize, TournamentSpectatorType spectatorType,
     TournamentPickType pickType, TournamentMapType mapType, string metadata, int count = 1)
 {
     return await TournamentRiotApi.GetInstance()
         .CreateTournamentCodesAsync(Id, teamSize, spectatorType, pickType, mapType, metadata, count);
 }
示例#10
0
        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("allowedSummonerIds", 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;
        }
示例#11
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 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));
        }
示例#12
0
        /// <summary>
        ///     Create multiple tournament codes for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <param name="count">The number of codes to create (max 1000).</param>
        /// <returns>A list of tournament codes in string format.</returns>
        public async Task<List<string>> CreateTournamentCodesAsync(int tournamentId, int teamSize,
            TournamentSpectatorType spectatorType, TournamentPickType pickType, TournamentMapType mapType,
            string metadata, int count = 1)
        {
            var body = new Dictionary<string, object>
            {
                {"teamSize", teamSize},
                {"spectatorType", spectatorType},
                {"pickType", pickType},
                {"mapType", mapType},
                {"metadata", metadata}
            };
            var json =
                await
                    requester.CreatePostRequestAsync(TournamentRootUrl + CreateCodeUrl, Region.global,
                        JsonConvert.SerializeObject(body),
                        new List<string>
                        {
                            string.Format("tournamentId={0}", tournamentId),
                            string.Format("count={0}", count)
                        });

            return await Task.Factory.StartNew(() => JsonConvert.DeserializeObject<List<string>>(json));
        }
示例#13
0
        /// <summary>
        ///     Create multiple tournament codes for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <param name="count">The number of codes to create (max 1000).</param>
        /// <returns>A list of tournament codes in string format.</returns>
        public List<string> CreateTournamentCodes(int tournamentId, int teamSize, TournamentSpectatorType spectatorType,
            TournamentPickType pickType, TournamentMapType mapType, string metadata, int count = 1)
        {
            var body = new Dictionary<string, object>
            {
                {"teamSize", teamSize},
                {"spectatorType", spectatorType},
                {"pickType", pickType},
                {"mapType", mapType},
                {"metadata", metadata}
            };
            var json = requester.CreatePostRequest(TournamentRootUrl + CreateCodeUrl, Region.global,
                JsonConvert.SerializeObject(body),
                new List<string> { string.Format("tournamentId={0}", tournamentId), string.Format("count={0}", count) });

            // json is a list of strings
            var tournamentCodes = JsonConvert.DeserializeObject<List<string>>(json);

            return tournamentCodes;
        }
示例#14
0
 /// <summary>
 ///     Create a tournament code for the tournament asynchronously.
 /// </summary>
 /// <param name="teamSize">The team size for the tournament code game.</param>
 /// <param name="allowedSummonerIds">participants</param>
 /// <param name="spectatorType">The spectator mode for the tournament code game.</param>
 /// <param name="pickType">The pick mode for tournament code game.</param>
 /// <param name="mapType">The game map for the tournament code game</param>
 /// <param name="metadata">The metadata for tournament code.</param>
 /// <returns>The tournament code.</returns>
 public async Task <string> CreateTournamentCodeAsync(int teamSize, List <long> allowedSummonerIds,
                                                      TournamentSpectatorType spectatorType, TournamentPickType pickType, TournamentMapType mapType,
                                                      string metadata)
 {
     return(await TournamentRiotApi.GetInstance()
            .CreateTournamentCodeAsync(Id, teamSize, allowedSummonerIds, spectatorType, pickType, mapType, metadata));
 }
示例#15
0
 /// <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);
 }
示例#16
0
 /// <summary>
 ///     Create multiple tournament codes for the tournament asynchronously.
 /// </summary>
 /// <param name="teamSize">The team size for the tournament code game.</param>
 /// <param name="spectatorType">The spectator mode for the tournament code game.</param>
 /// <param name="pickType">The pick mode for tournament code game.</param>
 /// <param name="mapType">The game map for the tournament code game</param>
 /// <param name="metadata">The metadata for tournament code.</param>
 /// <param name="count">The number of codes to be created</param>
 /// <returns>A list of the created tournament codes</returns>
 public async Task <List <string> > CreateTournamentCodesAsync(int teamSize, TournamentSpectatorType spectatorType,
                                                               TournamentPickType pickType, TournamentMapType mapType, string metadata, int count = 1)
 {
     return(await TournamentRiotApi.GetInstance()
            .CreateTournamentCodesAsync(Id, teamSize, spectatorType, pickType, mapType, metadata, count));
 }
示例#17
0
        /// <summary>
        ///     Create a tournament code for the given tournament id.
        /// </summary>
        /// <param name="tournamentId">The tournament ID</param>
        /// <param name="teamSize">The team size of the game. Valid values are 1-5.</param>
        /// <param name="allowedSummonerIds">
        ///     Optional list of participants in order to validate the players eligible to join the
        ///     lobby. NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and
        ///     teamTwo. We may add the ability to enforce at the team level in the future.
        /// </param>
        /// <param name="spectatorType">The spectator type of the game.</param>
        /// <param name="pickType">The pick type of the game.</param>
        /// <param name="mapType">The map type of the game.</param>
        /// <param name="metadata">
        ///     Optional string that may contain any data in any format, if specified at all. Used to denote any
        ///     custom information about the game.
        /// </param>
        /// <returns>The tournament code in string format.</returns>
        public string CreateTournamentCode(int tournamentId, int teamSize, List<long> allowedSummonerIds,
            TournamentSpectatorType spectatorType, TournamentPickType pickType, TournamentMapType mapType,
            string metadata)
        {
            var body = new Dictionary<string, object>
            {
                {"teamSize", teamSize},
                {"allowedSummonerIds", new Dictionary<string, object> {{"participants", allowedSummonerIds}}},
                {"spectatorType", spectatorType},
                {"pickType", pickType},
                {"mapType", mapType},
                {"metadata", metadata}
            };
            var json = requester.CreatePostRequest(TournamentRootUrl + CreateCodeUrl, Region.global,
                JsonConvert.SerializeObject(body),
                new List<string> { string.Format("tournamentId={0}", tournamentId), string.Format("count={0}", 1) });

            // json is a list of strings
            var tournamentCodes = JsonConvert.DeserializeObject<List<string>>(json);

            return tournamentCodes.FirstOrDefault();
        }