Esempio n. 1
0
        /// <summary> Reorders the provided channels and optionally places them after a certain channel. </summary>
        public Task ReorderChannels(IEnumerable <Channel> channels, Channel after = null)
        {
            if (channels == null)
            {
                throw new ArgumentNullException(nameof(channels));
            }

            var request = new ReorderChannelsRequest(Id)
            {
                ChannelIds = channels.Select(x => x.Id).ToArray(),
                StartPos   = after != null ? after.Position + 1 : channels.Min(x => x.Position)
            };

            return(Client.ClientAPI.Send(request));
        }
Esempio n. 2
0
        public Task ReorderChannels(string serverId, IEnumerable <string> channelIds, int startPos = 0)
        {
            if (serverId == null)
            {
                throw new ArgumentNullException(nameof(serverId));
            }
            if (channelIds == null)
            {
                throw new ArgumentNullException(nameof(channelIds));
            }
            if (startPos < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(startPos), "startPos must be a positive integer.");
            }

            uint pos      = (uint)startPos;
            var  channels = channelIds.Select(x => new ReorderChannelsRequest.Channel {
                Id = x, Position = pos++
            });
            var request = new ReorderChannelsRequest(channels);

            return(_rest.Patch(Endpoints.ServerChannels(serverId), request));
        }
Esempio n. 3
0
		public Task ReorderChannels(string serverId, IEnumerable<string> channelIds, int startPos = 0)
		{
			if (serverId == null) throw new ArgumentNullException(nameof(serverId));
			if (channelIds == null) throw new ArgumentNullException(nameof(channelIds));
			if (startPos < 0) throw new ArgumentOutOfRangeException(nameof(startPos), "startPos must be a positive integer.");

			uint pos = (uint)startPos;
			var channels = channelIds.Select(x => new ReorderChannelsRequest.Channel { Id = x, Position = pos++ });
			var request = new ReorderChannelsRequest(channels);
			return _rest.Patch(Endpoints.ServerChannels(serverId), request);
		}