Skip to content

Commit

Permalink
Add new field to ApplicationTeamMember: role
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherZane committed Dec 18, 2023
1 parent 27672f3 commit f1b0918
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public interface IApplicationTeamMember : IUser, IJsonUpdatable<TeamMemberJsonMo
/// Gets the permissions of this member.
/// </summary>
IReadOnlyList<string> Permissions { get; }
}

/// <summary>
/// Gets the role of this member.
/// </summary>
TeamMemberRole Role { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public class TransientApplicationTeamMember : TransientUser, IApplicationTeamMem
/// <inheritdoc/>
public IReadOnlyList<string> Permissions => Model.Permissions;

/// <inheritdoc/>
public TeamMemberRole Role => Model.Role;

/// <inheritdoc/>
public new TeamMemberJsonModel Model { get; }

Expand All @@ -23,4 +26,4 @@ public TransientApplicationTeamMember(IClient client, TeamMemberJsonModel model)
{
Model = model;
}
}
}
29 changes: 29 additions & 0 deletions src/Disqord.Core/Enums/TeamMemberRole.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Runtime.Serialization;
using Disqord.Serialization.Json;

namespace Disqord;

/// <summary>
/// Represents the role of team member in an application team.
/// </summary>
[StringEnum]
public enum TeamMemberRole
{
/// <summary>
/// Represents a team administrator.
/// </summary>
[EnumMember(Value = "admin")]
Administrator,

/// <summary>
/// Represents a team developer.
/// </summary>
[EnumMember(Value = "developer")]
Developer,

/// <summary>
/// Represents a read-only team member.
/// </summary>
[EnumMember(Value = "read_only")]
ReadOnly
}
5 changes: 4 additions & 1 deletion src/Disqord.Core/Models/Application/TeamMemberJsonModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ public class TeamMemberJsonModel : JsonModel

[JsonProperty("user")]
public UserJsonModel User = null!;
}

[JsonProperty("role")]
public TeamMemberRole Role;
}

0 comments on commit f1b0918

Please sign in to comment.