Пример #1
0
        /// <summary>
        /// Changes a channels configuration using given properties.
        /// </summary>
        /// <param name="channelId">the id of the channel to edit</param>
        /// <param name="channelModification">the parameters of the channel as properties</param>
        public SimpleResponse EditChannel(uint channelId, ChannelModification channelModification)
        {
            if (channelModification == null)
                throw new ArgumentNullException("channelModification");

            Command command = CommandName.ChannelEdit.CreateCommand();
            command.AddParameter("cid", channelId);
            channelModification.AddToCommand(command);

            return ResponseBase<SimpleResponse>.Parse(SendCommand(command));
        }
Пример #2
0
        /// <summary>
        /// Creates a new channel using the given properties and displays its ID.
        /// </summary>
        /// <param name="channelModification">the parameters of the channel as properties</param>
        public SingleValueResponse<uint?> CreateChannel(ChannelModification channelModification)
        {
            if (channelModification == null)
                throw new ArgumentNullException("channelModification");

            if (channelModification.Name.IsNullOrTrimmedEmpty())
                throw new ArgumentException("To create a channel you must at least provide a name for the channel.");

            Command command = CommandName.ChannelCreate.CreateCommand();
            channelModification.AddToCommand(command);
            return ResponseBase<SingleValueResponse<uint?>>.Parse(SendCommand(command), "cid");
        }