Skip to content

feat: .NET SDK update for version 5.0.0#97

Merged
ArnabChatterjee20k merged 3 commits into
mainfrom
dev
Jun 1, 2026
Merged

feat: .NET SDK update for version 5.0.0#97
ArnabChatterjee20k merged 3 commits into
mainfrom
dev

Conversation

@premtsd-code

@premtsd-code premtsd-code commented May 27, 2026

Copy link
Copy Markdown
Contributor

This PR contains updates to the .NET SDK for version 5.0.0.

@greptile-apps

greptile-apps Bot commented May 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates the .NET SDK from version 4.2.0 to 5.0.0, adding new services, models, and enums while removing deprecated ones and introducing several breaking changes.

  • New Organization service for managing organization-level API keys and projects; new Presences CRUD endpoints; new PolicyDenyAliasedEmail/DisposableEmail/FreeEmail models and corresponding ProjectPolicyId entries.
  • Enum renames: ThemeBrowserTheme, NameHealthQueueName, ScopesProjectKeyScopes (all three are breaking); StatusCode members lose numeric suffixes (documented as breaking); Region, OrganizationKeyScopes enums added.
  • Function, Site, and UsageGauge models gain new fields (providerBranches, providerPaths, resourceType, resourceId); ActivityEvent user-prefixed fields renamed to actor-prefixed.

Confidence Score: 5/5

The functional changes are safe and internally consistent; the only gap is incomplete changelog coverage of three compile-time-breaking enum renames.

All model, service, and enum changes follow existing SDK conventions correctly. Constructor parameters, From() factories, and ToMap() methods are updated in lock-step across every affected model. The pre-existing Presence.metadata ToString() issue was flagged in a prior review. The one gap found here is that three breaking enum renames (Scopes, Theme, Name) are absent from the CHANGELOG Breaking section, which could surprise consumers upgrading from 4.x but does not affect runtime correctness.

CHANGELOG.md — three compile-time-breaking enum renames should be listed in the Breaking section alongside the existing entries.

Important Files Changed

Filename Overview
CHANGELOG.md Version bumped to 5.0.0 with new features and breaking changes; three breaking enum renames (Scopes→ProjectKeyScopes, Theme→BrowserTheme, Name→HealthQueueName) not documented as breaking.
Appwrite/Models/Presence.cs Metadata field type changed from Dictionary to object? but still deserialized via ToString(), losing structured data (flagged in prior review).
Appwrite/Services/Organization.cs New service for managing organization-level API keys and projects; implementation follows existing SDK conventions correctly.
Appwrite/Services/Functions.cs Create/Update signatures updated: Scopes→ProjectKeyScopes, added providerBranches/providerPaths parameters; straightforward changes.
Appwrite/Models/Site.cs Added providerBranches and providerPaths fields; constructor, From(), and ToMap() all updated consistently.
Appwrite/Models/UsageGauge.cs Added resourceType and resourceId required fields; consistent with SDK pattern of direct map access for non-optional fields.
Appwrite/Models/ActivityEvent.cs Renamed userType/userId/userEmail/userName to actorType/actorId/actorEmail/actorName throughout the model; From() and ToMap() updated consistently.
Appwrite/Services/Presences.cs Renamed UpdatePresence to Update; new service fully implements List, Get, Upsert, Update, and Delete endpoints.

Reviews (3): Last reviewed commit: "chore: merge main and resolve version co..." | Re-trigger Greptile

Comment thread Appwrite/Client.cs
Comment on lines 581 to 583
case "bytes":
buffer = ((byte[])input.Data)
.Skip((int)offset)
.Take((int)Math.Min(size - offset, ChunkSize - 1))
.ToArray();
Buffer.BlockCopy((byte[])input.Data, (int)start, chunk, 0, length);
break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 The bytes case casts start (a long) to int before passing it as the srcOffset to Buffer.BlockCopy. For byte arrays whose size is close to or above int.MaxValue (~2 GB), the cast will silently overflow and copy from the wrong position, corrupting the upload. The other two source cases handle large offsets correctly via chunkStream.Seek(start, ...) and arithmetic on long.

Suggested change
case "bytes":
buffer = ((byte[])input.Data)
.Skip((int)offset)
.Take((int)Math.Min(size - offset, ChunkSize - 1))
.ToArray();
Buffer.BlockCopy((byte[])input.Data, (int)start, chunk, 0, length);
break;
case "bytes":
checked { Buffer.BlockCopy((byte[])input.Data, (int)start, chunk, 0, length); }
break;

Comment thread Appwrite/Client.cs
Comment on lines +617 to +622
if (index == 0)
{
uploadId = chunkResult.ContainsKey("$id")
? chunkResult["$id"]?.ToString() ?? string.Empty
: string.Empty;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 index == 0 branch inside workers is dead code

uploadId is captured by the closure and written here when index == 0. In every execution path that reaches the concurrent workers, chunk index 0 has already been uploaded in the serial if (offset == 0) block, so this branch can never execute inside the workers. Leaving it in place is misleading and could silently introduce a race if the chunk-building logic is ever changed.

@ArnabChatterjee20k ArnabChatterjee20k changed the title feat: .NET SDK update for version 4.0.0 feat: .NET SDK update for version 5.0.0 Jun 1, 2026
metadata: map.TryGetValue("metadata", out var additionalPropsValue)
? (Dictionary<string, object>)additionalPropsValue
: map
metadata: map.TryGetValue("metadata", out var metadata) ? metadata?.ToString() : null

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Structured metadata is silently destroyed

metadata?.ToString() is called on the value coming out of ObjectToInferredTypesConverter, which deserializes JSON objects into Dictionary<string, object?>. Calling .ToString() on a dictionary returns the type name, not the content. Any presence record whose metadata field is a JSON object will surface as a garbage string instead of the original structured data.

@ArnabChatterjee20k ArnabChatterjee20k merged commit e8ff274 into main Jun 1, 2026
1 check passed
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.

3 participants