Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
KubaZ2 committed Dec 16, 2022
1 parent fff351c commit 94dec17
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NetCord/Channels/TextChannels/Guild/ForumGuildChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public ForumGuildChannel(JsonChannel jsonModel, RestClient client) : base(jsonMo
public IEnumerable<ForumTag> AvailableTags { get; }
public ForumGuildChannelDefaultReaction? DefaultReactionEmoji { get; }
public int? DefaultThreadRateLimitPerUser => _jsonModel.DefaultThreadRateLimitPerUser;
public SortOrderType DefaultSortOrder => _jsonModel.DefaultSortOrder.GetValueOrDefault();
public SortOrderType? DefaultSortOrder => _jsonModel.DefaultSortOrder;
public ForumLayoutType DefaultForumLayout => _jsonModel.DefaultForumLayout.GetValueOrDefault();

#region Channel
public async Task<IGuildChannel> ModifyAsync(Action<GuildChannelOptions> action, RequestProperties? properties = null) => (IGuildChannel)await _client.ModifyGuildChannelAsync(Id, action, properties).ConfigureAwait(false);
Expand Down
14 changes: 14 additions & 0 deletions NetCord/ForumLayoutType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NetCord;

public enum ForumLayoutType
{
NotSet = 0,
ListView = 1,
GalleryView = 2,
}
3 changes: 3 additions & 0 deletions NetCord/JsonModels/JsonChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public partial class JsonChannel : JsonEntity
[JsonPropertyName("default_sort_order")]
public SortOrderType? DefaultSortOrder { get; set; }

[JsonPropertyName("default_forum_layout")]
public ForumLayoutType? DefaultForumLayout { get; set; }

[JsonPropertyName("message")]
public JsonMessage? Message { get; set; }

Expand Down
4 changes: 4 additions & 0 deletions NetCord/Rest/GuildChannelOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ internal GuildChannelOptions()
[JsonPropertyName("default_sort_order")]
public SortOrderType? DefaultSortOrder { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("default_forum_layout")]
public ForumLayoutType? DefaultForumLayout { get; set; }

[JsonSerializable(typeof(GuildChannelOptions))]
public partial class GuildChannelOptionsSerializerContext : JsonSerializerContext
{
Expand Down
4 changes: 4 additions & 0 deletions NetCord/Rest/GuildChannelProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public partial class GuildChannelProperties
[JsonPropertyName("default_sort_order")]
public SortOrderType? DefaultSortOrder { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("default_forum_layout")]
public ForumLayoutType? DefaultForumLayout { get; set; }

public GuildChannelProperties(string name)
{
Name = name;
Expand Down

0 comments on commit 94dec17

Please sign in to comment.