Skip to content

Add community invites#297

Open
KubaZ2 wants to merge 6 commits intoalphafrom
feature/community-invites
Open

Add community invites#297
KubaZ2 wants to merge 6 commits intoalphafrom
feature/community-invites

Conversation

@KubaZ2
Copy link
Copy Markdown
Member

@KubaZ2 KubaZ2 commented Mar 9, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

The documentation preview is available at https://preview.netcord.dev/297.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 InviteProperties to support multipart payloads (JSON + target users file) and add role_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.

@KubaZ2 KubaZ2 requested a review from Copilot April 3, 2026 15:31
@KubaZ2 KubaZ2 marked this pull request as ready for review April 3, 2026 15:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +85 to +86
if (!span.IsEmpty)
yield return Snowflake.Parse(span);
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
if (!span.IsEmpty)
yield return Snowflake.Parse(span);
if (!span.IsEmpty)
{
if (span.EndsWith((byte)'\r'))
span = span[..^1];
yield return Snowflake.Parse(span);
}

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
HttpContent IHttpSerializable.Serialize() => Serialize();

internal HttpContent Serialize()
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
HttpContent IHttpSerializable.Serialize() => Serialize();
internal HttpContent Serialize()
public HttpContent Serialize()

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +23
HttpContent IHttpSerializable.Serialize() => Serialize();

internal HttpContent Serialize() => new StreamContent(_stream);

Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
HttpContent IHttpSerializable.Serialize() => Serialize();
internal HttpContent Serialize() => new StreamContent(_stream);
public HttpContent Serialize() => new StreamContent(_stream);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants