예제 #1
0
 /// <summary>
 /// This method edits the specified channel.
 /// </summary>
 /// <param name="channel_id"> The ID of the channel.</param>
 /// <param name="obj">The channel.</param>
 /// <returns>
 /// 200 OK	The channel was edited.
 /// 400 Bad Request A parameter is invalid.
 /// </returns>
 public virtual RestResult <Channel> EditAChannel(string channel_id, ChannelEditParameters obj)
 => RootAuthorization()
 .Command($"/channels/{channel_id}")
 .EnableFormUrlEncoded(true)
 .FormUrlEncoded((pars) =>
 {
     foreach (var item in obj.ToEnumerable())
     {
         pars.Add(item.Key, item.Value);
     }
 })
 .Patch <Channel>();
예제 #2
0
 /// <summary>
 /// This method creates a new channel.
 /// </summary>
 /// <param name="name">The name of the channel.</param>
 /// <param name="privacy">
 /// The privacy level of the channel.
 /// Option descriptions:
 ///     anybody - Anyone can access the channel.
 ///     moderators - Only moderators can access the channel.
 ///     user - Only moderators and designated users can access the channel.
 /// <returns>
 ///     200 OK	The channel was created.
 ///     400 Bad Request A parameter is invalid.
 ///     403 Forbidden The authenticated user can't create channels.
 /// </returns>
 public virtual RestResult <Channel> CreateAChannel(ChannelEditParameters obj)
 => RootAuthorization()
 .Command($"/channels")
 .EnableFormUrlEncoded(true)
 .FormUrlEncoded((pars) =>
 {
     foreach (var item in obj.ToEnumerable())
     {
         if (item.Value != null)
         {
             pars.Add(item.Key, item.Value);
         }
     }
 })
 .Post <Channel>();