Conversation
|
The documentation preview is available at https://preview.netcord.dev/297. |
There was a problem hiding this comment.
Pull request overview
Adds REST support for “community invite” target-user management by introducing new invite properties, upload/download endpoints, and a job-status model, wired into the source-generated JSON serialization context.
Changes:
- Add REST client endpoints to fetch, update, and check job status for invite target users.
- Extend
InvitePropertiesto support multipart payloads (JSON + target users file) and addrole_ids. - Introduce models for invite target user job status and a streaming file serializer for user IDs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| NetCord/Serialization.cs | Registers the new JSON model in the source-generated serializer context. |
| NetCord/Rest/RestClient.Invite.cs | Adds invite target-users endpoints (streaming download, multipart upload, job status). |
| NetCord/Rest/RestClient.Channel.cs | Updates invite creation to send no body when properties are null, otherwise serialize via InviteProperties. |
| NetCord/Rest/JsonModels/JsonInviteTargetUsersJobStatus.cs | Adds JSON DTO for invite target-users job status response. |
| NetCord/Rest/InviteTargetUsersProperties.cs | Adds HTTP-serializable “target users file” builder from stream/enumerable. |
| NetCord/Rest/InviteTargetUsersJobStatus.cs | Adds public wrapper model and status enum for the job status response. |
| NetCord/Rest/InviteProperties.cs | Adds multipart-capable HTTP serialization, target-users file support, and role_ids. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!span.IsEmpty) | ||
| yield return Snowflake.Parse(span); |
There was a problem hiding this comment.
When the response stream ends without a trailing '\n', the remaining span is parsed without trimming a possible trailing '\r'. Earlier lines explicitly strip '\r' before parsing, so the final line should apply the same normalization to avoid a FormatException if the last line ends with CR (e.g., CRLF split/truncated).
| if (!span.IsEmpty) | |
| yield return Snowflake.Parse(span); | |
| if (!span.IsEmpty) | |
| { | |
| if (span.EndsWith((byte)'\r')) | |
| span = span[..^1]; | |
| yield return Snowflake.Parse(span); | |
| } |
| HttpContent IHttpSerializable.Serialize() => Serialize(); | ||
|
|
||
| internal HttpContent Serialize() |
There was a problem hiding this comment.
InviteProperties implements IHttpSerializable via an explicit interface method plus an internal Serialize(). Elsewhere in the codebase, IHttpSerializable types expose a public Serialize() (e.g., NetCord/Rest/AttachmentProperties.cs:69, NetCord/Rest/GuildStickerProperties.cs:37), which makes the API discoverable and consistent. Consider making Serialize() public here and removing the explicit-interface/internal split.
| HttpContent IHttpSerializable.Serialize() => Serialize(); | |
| internal HttpContent Serialize() | |
| public HttpContent Serialize() |
| HttpContent IHttpSerializable.Serialize() => Serialize(); | ||
|
|
||
| internal HttpContent Serialize() => new StreamContent(_stream); | ||
|
|
There was a problem hiding this comment.
InviteTargetUsersProperties implements IHttpSerializable via an explicit interface method plus an internal Serialize(). Most IHttpSerializable implementations in this repo provide a public Serialize() (e.g., NetCord/Rest/AttachmentProperties.cs:69, NetCord/Rest/GuildStickerProperties.cs:37), which is more consistent and discoverable for consumers. Consider exposing Serialize() publicly and avoiding the explicit-interface/internal split.
| HttpContent IHttpSerializable.Serialize() => Serialize(); | |
| internal HttpContent Serialize() => new StreamContent(_stream); | |
| public HttpContent Serialize() => new StreamContent(_stream); |
No description provided.