-
-
Notifications
You must be signed in to change notification settings - Fork 40
Implemented gateway events GUILD_JOIN_REQUEST_UPDATE and GUILD_JOIN_REQUEST_DELETE. #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
f0256ef
Implemented gateway events GUILD_JOIN_REQUEST_UPDATE and GUILD_JOIN_R…
23a5b3e
Update NetCord/Gateway/GatewayClient.cs
KubaZ2 23250f5
Update NetCord/Gateway/GuildJoinRequestStatus.cs
KubaZ2 bf4ed2e
Update NetCord/Gateway/GuildJoinRequestStatus.cs
KubaZ2 cbe8a66
Update NetCord/Gateway/JsonModels/EventArgs/JsonGuildJoinRequestDelet…
KubaZ2 df34fde
Update NetCord/Gateway/JsonModels/JsonGuildJoinRequest.cs
KubaZ2 e26d458
Update NetCord/Gateway/GuildJoinRequest.cs
KubaZ2 89eed67
Update NetCord/Gateway/JsonModels/JsonGuildJoinRequest.cs
KubaZ2 4a51f83
Update NetCord/Gateway/JsonModels/JsonVerificationField.cs
KubaZ2 f1cdd22
Update NetCord/Gateway/GuildJoinRequest.cs
KubaZ2 6ab9805
Apply suggestions from code review
KubaZ2 7ab50d5
Add new lines
KubaZ2 5023062
Use a primary constructor
KubaZ2 ea30ce4
Add the `GuildJoinRequestUpdate` and `GuildJoinRequestDelete` to `Sha…
KubaZ2 e5917a6
Refactor `GuildJoinRequest.CreatedAt` and add missing `Id` property
KubaZ2 a934db4
Rename `VerificationField` to `GuildJoinRequestFormResponse`
KubaZ2 6f43c55
Rename `JsonGuildJoinRequestDeleteEventArgs.Id` to `JoinRequestId`
KubaZ2 812ecef
Add `JsonGuildJoinRequestFormResponse.Description`
KubaZ2 a440d9d
Fix new lines
KubaZ2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
NetCord/Gateway/EventArgs/GuildJoinRequestDeleteEventArgs.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace NetCord.Gateway; | ||
|
|
||
| public class GuildJoinRequestDeleteEventArgs(JsonModels.EventArgs.JsonGuildJoinRequestDeleteEventArgs jsonModel) : IJsonModel<JsonModels.EventArgs.JsonGuildJoinRequestDeleteEventArgs> | ||
| { | ||
| JsonModels.EventArgs.JsonGuildJoinRequestDeleteEventArgs IJsonModel<JsonModels.EventArgs.JsonGuildJoinRequestDeleteEventArgs>.JsonModel => jsonModel; | ||
|
|
||
| public ulong JoinRequestId => jsonModel.JoinRequestId; | ||
|
|
||
| public ulong UserId => jsonModel.UserId; | ||
|
|
||
| public ulong GuildId => jsonModel.GuildId; | ||
| } |
14 changes: 14 additions & 0 deletions
14
NetCord/Gateway/EventArgs/GuildJoinRequestUpdateEventArgs.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| using NetCord.Rest; | ||
|
|
||
| namespace NetCord.Gateway; | ||
|
|
||
| public class GuildJoinRequestUpdateEventArgs(JsonModels.EventArgs.JsonGuildJoinRequestUpdateEventArgs jsonModel, RestClient client) : IJsonModel<JsonModels.EventArgs.JsonGuildJoinRequestUpdateEventArgs> | ||
| { | ||
| JsonModels.EventArgs.JsonGuildJoinRequestUpdateEventArgs IJsonModel<JsonModels.EventArgs.JsonGuildJoinRequestUpdateEventArgs>.JsonModel => jsonModel; | ||
|
|
||
| public GuildJoinRequestStatus Status => jsonModel.Status; | ||
|
|
||
| public GuildJoinRequest Request { get; } = new(jsonModel.Request, client); | ||
|
|
||
| public ulong GuildId => jsonModel.GuildId; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using NetCord.Rest; | ||
|
|
||
| namespace NetCord.Gateway; | ||
|
|
||
| public class GuildJoinRequest(JsonModels.JsonGuildJoinRequest jsonModel, RestClient client) : Entity, IJsonModel<JsonModels.JsonGuildJoinRequest> | ||
| { | ||
| JsonModels.JsonGuildJoinRequest IJsonModel<JsonModels.JsonGuildJoinRequest>.JsonModel => jsonModel; | ||
|
|
||
| public override ulong Id => jsonModel.Id; | ||
| public GuildJoinRequestStatus ApplicationStatus => jsonModel.ApplicationStatus; | ||
| //public DateTimeOffset CreatedAt => jsonModel.CreatedAt; | ||
| public ulong GuildId => jsonModel.GuildId; | ||
| public DateTimeOffset LastSeenAt => jsonModel.LastSeenAt; | ||
| public string? RejectionReason => jsonModel.RejectionReason; | ||
| public ulong UserId => jsonModel.UserId; | ||
| public User User { get; } = new(jsonModel.User, client); | ||
| public IReadOnlyList<GuildJoinRequestFormResponse> FormResponses { get; } = jsonModel.FormResponses.Select(e => new GuildJoinRequestFormResponse(e)).ToArray(); | ||
| public User ActionedByUser { get; } = new(jsonModel.ActionedByUser, client); | ||
| public ulong ActionedAt => jsonModel.ActionedAt; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace NetCord.Gateway; | ||
|
|
||
| public class GuildJoinRequestFormResponse(JsonModels.JsonGuildJoinRequestFormResponse jsonModel) : IJsonModel<JsonModels.JsonGuildJoinRequestFormResponse> | ||
| { | ||
| JsonModels.JsonGuildJoinRequestFormResponse IJsonModel<JsonModels.JsonGuildJoinRequestFormResponse>.JsonModel => jsonModel; | ||
|
|
||
| public GuildJoinRequestFormResponseFieldType FieldType => jsonModel.FieldType; | ||
| public string Label => jsonModel.Label; | ||
| public bool Required => jsonModel.Required; | ||
| public bool IsResponse => jsonModel.Response; | ||
| public IReadOnlyList<string> Values => jsonModel.Values; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway; | ||
|
|
||
| [JsonConverter(typeof(JsonConverters.StringEnumConverterWithErrorHandling<GuildJoinRequestFormResponseFieldType>))] | ||
| public enum GuildJoinRequestFormResponseFieldType | ||
| { | ||
| [JsonPropertyName("TERMS")] | ||
| Terms, | ||
| [JsonPropertyName("TEXT_INPUT")] | ||
| TextInput, | ||
| [JsonPropertyName("PARAGRAPH")] | ||
| Paragraph, | ||
| [JsonPropertyName("MULTIPLE_CHOICE")] | ||
| MultipleChoice, | ||
| [JsonPropertyName("VERIFICATION")] | ||
| Verification, | ||
| [JsonPropertyName("FILE_UPLOAD")] | ||
| FileUpload, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway; | ||
|
KubaZ2 marked this conversation as resolved.
|
||
|
|
||
| [JsonConverter(typeof(JsonConverters.StringEnumConverterWithErrorHandling<GuildJoinRequestStatus>))] | ||
| public enum GuildJoinRequestStatus | ||
| { | ||
| [JsonPropertyName("STARTED")] | ||
| Started, | ||
| [JsonPropertyName("PENDING")] | ||
| Pending, | ||
| [JsonPropertyName("REJECTED")] | ||
| Rejected, | ||
| [JsonPropertyName("APPROVED")] | ||
| Approved, | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
NetCord/Gateway/JsonModels/EventArgs/JsonGuildJoinRequestDeleteEventArgs.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway.JsonModels.EventArgs; | ||
|
|
||
| public class JsonGuildJoinRequestDeleteEventArgs | ||
| { | ||
| [JsonPropertyName("id")] | ||
| public ulong JoinRequestId { get; set; } | ||
|
|
||
| [JsonPropertyName("user_id")] | ||
| public ulong UserId { get; set; } | ||
|
|
||
| [JsonPropertyName("guild_id")] | ||
| public ulong GuildId { get; set; } | ||
| } |
15 changes: 15 additions & 0 deletions
15
NetCord/Gateway/JsonModels/EventArgs/JsonGuildJoinRequestUpdateEventArgs.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway.JsonModels.EventArgs; | ||
|
|
||
| public class JsonGuildJoinRequestUpdateEventArgs | ||
| { | ||
| [JsonPropertyName("status")] | ||
| public GuildJoinRequestStatus Status { get; set; } | ||
|
|
||
| [JsonPropertyName("request")] | ||
| public JsonGuildJoinRequest Request { get; set; } | ||
|
|
||
| [JsonPropertyName("guild_id")] | ||
| public ulong GuildId { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| using NetCord.JsonModels; | ||
|
|
||
| namespace NetCord.Gateway.JsonModels; | ||
|
KubaZ2 marked this conversation as resolved.
|
||
|
|
||
| public class JsonGuildJoinRequest : JsonEntity | ||
| { | ||
| [JsonPropertyName("application_status")] | ||
| public GuildJoinRequestStatus ApplicationStatus { get; set; } | ||
|
|
||
| //[JsonPropertyName("created_at")] | ||
| //public DateTimeOffset CreatedAt { get; set; } | ||
|
|
||
| [JsonPropertyName("guild_id")] | ||
| public ulong GuildId { get; set; } | ||
|
|
||
| [JsonPropertyName("last_seen")] | ||
| public DateTimeOffset LastSeenAt { get; set; } | ||
|
|
||
| [JsonPropertyName("rejection_reason")] | ||
| public string? RejectionReason { get; set; } | ||
|
|
||
| [JsonPropertyName("user_id")] | ||
| public ulong UserId { get; set; } | ||
|
|
||
| [JsonPropertyName("user")] | ||
| public JsonUser User { get; set; } | ||
|
|
||
| [JsonPropertyName("form_responses")] | ||
| public IReadOnlyList<JsonGuildJoinRequestFormResponse> FormResponses { get; set; } | ||
|
|
||
| [JsonPropertyName("actioned_by_user")] | ||
| public JsonUser ActionedByUser { get; set; } | ||
|
|
||
| [JsonPropertyName("actioned_at")] | ||
| public ulong ActionedAt { get; set; } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
NetCord/Gateway/JsonModels/JsonGuildJoinRequestFormResponse.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway.JsonModels; | ||
|
|
||
| public partial class JsonGuildJoinRequestFormResponse | ||
| { | ||
| [JsonPropertyName("field_type")] | ||
| public GuildJoinRequestFormResponseFieldType FieldType { get; set; } | ||
|
|
||
| [JsonPropertyName("label")] | ||
| public string Label { get; set; } | ||
|
|
||
| [JsonPropertyName("description")] | ||
| public string? Description { get; set; } | ||
|
|
||
| [JsonPropertyName("required")] | ||
| public bool Required { get; set; } | ||
|
|
||
| [JsonPropertyName("response")] | ||
| public bool Response { get; set; } | ||
|
|
||
| [JsonPropertyName("values")] | ||
| public IReadOnlyList<string> Values { get; set; } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.