-
-
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 1 commit
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.Id; | ||
|
|
||
| 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,25 @@ | ||
| using NetCord.Rest; | ||
|
|
||
| namespace NetCord.Gateway; | ||
|
KubaZ2 marked this conversation as resolved.
|
||
| public class GuildJoinRequest : IJsonModel<JsonModels.JsonGuildJoinRequest> | ||
| { | ||
| private readonly JsonModels.JsonGuildJoinRequest _jsonModel; | ||
| JsonModels.JsonGuildJoinRequest IJsonModel<JsonModels.JsonGuildJoinRequest>.JsonModel => _jsonModel; | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| public GuildJoinRequestStatus ApplicationStatus => _jsonModel.ApplicationStatus; | ||
| public DateTimeOffset? CreatedAt => _jsonModel.CreatedAt; | ||
| public ulong GuildId => _jsonModel.GuildId; | ||
| public DateTimeOffset LastSeen => _jsonModel.LastSeen; | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| public string? RejectionReason => _jsonModel.RejectionReason; | ||
| public ulong UserId => _jsonModel.UserId; | ||
| public User User { get; } | ||
| public IReadOnlyList<VerificationField> FormResponses { get; } | ||
| public User ActionedByUser { get; } | ||
| public ulong ActionedAt => _jsonModel.ActionedAt; | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| public GuildJoinRequest(JsonModels.JsonGuildJoinRequest jsonModel, RestClient client) | ||
| { | ||
| _jsonModel = jsonModel; | ||
| User = new User(jsonModel.User, client); | ||
| ActionedByUser = new User(jsonModel.ActionedByUser, client); | ||
| FormResponses = _jsonModel.FormResponses.Select(e => new VerificationField(e)).ToList(); | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| } | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| } | ||
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; | ||
|
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 | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| } | ||
13 changes: 13 additions & 0 deletions
13
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,13 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway.JsonModels.EventArgs; | ||
|
|
||
| public class JsonGuildJoinRequestDeleteEventArgs | ||
| { | ||
| [JsonPropertyName("id")] | ||
| public ulong Id { get; set; } | ||
| [JsonPropertyName("user_id")] | ||
| public ulong UserId { get; set; } | ||
| [JsonPropertyName("guild_id")] | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| public ulong GuildId { get; set; } | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
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,13 @@ | ||
| 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,37 @@ | ||
| 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 LastSeen { get; set; } | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
|
|
||
| [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<JsonVerificationField> FormResponses { get; set; } | ||
|
|
||
| [JsonPropertyName("actioned_by_user")] | ||
| public JsonUser ActionedByUser { get; set; } | ||
|
|
||
| [JsonPropertyName("actioned_at")] | ||
| public ulong ActionedAt { 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,20 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway.JsonModels; | ||
|
KubaZ2 marked this conversation as resolved.
|
||
| public partial class JsonVerificationField | ||
| { | ||
| [JsonPropertyName("field_type")] | ||
| public VerificationFieldType FieldType { get; set; } | ||
|
|
||
| [JsonPropertyName("label")] | ||
| public string Label { 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| namespace NetCord.Gateway; | ||
|
|
||
| public class VerificationField(JsonModels.JsonVerificationField jsonModel) : IJsonModel<JsonModels.JsonVerificationField> | ||
| { | ||
| private readonly JsonModels.JsonVerificationField _jsonModel = jsonModel; | ||
| JsonModels.JsonVerificationField IJsonModel<JsonModels.JsonVerificationField>.JsonModel => _jsonModel; | ||
| public VerificationFieldType FieldType => _jsonModel.FieldType; | ||
| public string Label => _jsonModel.Label; | ||
| public bool Required => _jsonModel.Required; | ||
| public bool IsResponse => _jsonModel.Response; | ||
| public IReadOnlyList<string> Values => _jsonModel.Values; | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| } | ||
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,19 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace NetCord.Gateway; | ||
|
KubaZ2 marked this conversation as resolved.
|
||
| [JsonConverter(typeof(JsonConverters.StringEnumConverterWithErrorHandling<VerificationFieldType>))] | ||
| public enum VerificationFieldType | ||
| { | ||
| [JsonPropertyName("TERMS")] | ||
| Terms, | ||
| [JsonPropertyName("TEXT_INPUT")] | ||
| TextInput, | ||
| [JsonPropertyName("PARAGRAPH")] | ||
| Paragraph, | ||
| [JsonPropertyName("MULTIPLE_CHOICE")] | ||
| MultipleChoise, | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| [JsonPropertyName("VERIFICATION")] | ||
| Verification, | ||
| [JsonPropertyName("FILE_UPLOAD")] | ||
| FileUpload | ||
|
KubaZ2 marked this conversation as resolved.
Outdated
|
||
| } | ||
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.