Skip to content

feat: .NET SDK update for version 4.1.0#93

Merged
premtsd-code merged 2 commits into
mainfrom
dev
May 20, 2026
Merged

feat: .NET SDK update for version 4.1.0#93
premtsd-code merged 2 commits into
mainfrom
dev

Conversation

@premtsd-code

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

Copy link
Copy Markdown
Contributor

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

Changes

  • Added Deno121, Deno124, and Deno135 runtime support to BuildRuntime and Runtime enums
  • Added SizeActual property to File model for tracking actual file sizes
  • Breaking: Changed BillingLimits properties to nullable types in constructor and model
  • Breaking: Changed BillingLimits property to nullable in Project model
  • Updated advisor authentication examples to use API key instead of session

@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates the .NET SDK to version 4.1.0, adding new Deno runtime variants, a SizeActual field to the File model, making BillingLimits properties nullable to handle sparse server responses, and correcting advisor documentation examples to use API key authentication.

  • Runtime enums: Deno121, Deno124, and Deno135 added to both BuildRuntime and Runtime enums in correct version order.
  • File model: SizeActual added as a non-nullable long, following the established SDK pattern for required server fields.
  • BillingLimits / Project (breaking): All BillingLimits fields and the Project.BillingLimits property are now nullable; however, the From() deserialization methods still directly index into the dictionary (map["key"]), meaning absent keys in a sparse server response will throw KeyNotFoundException at runtime rather than safely yielding null.

Confidence Score: 4/5

The nullable BillingLimits changes are incomplete — both BillingLimits.From and Project.From still use direct dictionary indexing that throws at runtime when the server omits a key, which is exactly the sparse-map scenario this change was designed to handle.

The enum additions, File.SizeActual, version bumps, and documentation fixes are all clean. The risk is concentrated in the BillingLimits deserialization path: direct map["key"] access in From() will throw KeyNotFoundException for any field the server omits from a sparse response, and Project.From unconditionally calls BillingLimits.From without guarding against a missing or null billingLimits key. Until those guards are in place, any response that omits billing data will cause a runtime crash.

Appwrite/Models/BillingLimits.cs and Appwrite/Models/Project.cs — the null-guard logic in their From() methods needs to use TryGetValue or ContainsKey instead of direct dictionary indexing to safely handle sparse server responses.

Important Files Changed

Filename Overview
Appwrite/Models/BillingLimits.cs All fields made nullable and null checks added, but map["key"] access still throws KeyNotFoundException for missing keys in a sparse server response; the null guard doesn't protect against absent keys.
Appwrite/Models/Project.cs BillingLimits property changed to nullable, but the From() deserialization at line 179 unconditionally accesses map["billingLimits"] and calls BillingLimits.From without a null/missing-key guard.
Appwrite/Models/File.cs SizeActual field added as non-nullable long, following the established SDK pattern; deserialized consistently with existing fields.
Appwrite/Enums/BuildRuntime.cs Deno121, Deno124, and Deno135 entries added in correct version order before Deno140.
Appwrite/Enums/Runtime.cs Same Deno runtime additions as BuildRuntime.cs, correctly ordered.
Appwrite/Client.cs Version bumped from 4.0.0 to 4.1.0 in user-agent and x-sdk-version headers.
Appwrite/Appwrite.csproj Package version bumped to 4.1.0, consistent with all other version references.
docs/examples/advisor/get-insight.md Auth method corrected from SetSession to SetKey — advisor endpoints are server-side APIs that require an API key.
CHANGELOG.md 4.1.0 changelog entry added, accurately describing all changes including breaking changes.

Reviews (2): Last reviewed commit: "feat: update .NET SDK to 4.1.0" | Re-trigger Greptile

Comment on lines 59 to 68
public static BillingLimits From(Dictionary<string, object> map) => new BillingLimits(
bandwidth: Convert.ToInt64(map["bandwidth"]),
storage: Convert.ToInt64(map["storage"]),
users: Convert.ToInt64(map["users"]),
executions: Convert.ToInt64(map["executions"]),
gBHours: Convert.ToInt64(map["GBHours"]),
imageTransformations: Convert.ToInt64(map["imageTransformations"]),
authPhone: Convert.ToInt64(map["authPhone"]),
budgetLimit: Convert.ToInt64(map["budgetLimit"])
bandwidth: map["bandwidth"] == null ? null : Convert.ToInt64(map["bandwidth"]),
storage: map["storage"] == null ? null : Convert.ToInt64(map["storage"]),
users: map["users"] == null ? null : Convert.ToInt64(map["users"]),
executions: map["executions"] == null ? null : Convert.ToInt64(map["executions"]),
gBHours: map["GBHours"] == null ? null : Convert.ToInt64(map["GBHours"]),
imageTransformations: map["imageTransformations"] == null ? null : Convert.ToInt64(map["imageTransformations"]),
authPhone: map["authPhone"] == null ? null : Convert.ToInt64(map["authPhone"]),
budgetLimit: map["budgetLimit"] == null ? null : Convert.ToInt64(map["budgetLimit"])
);

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 Sparse-map access will throw KeyNotFoundException

The CHANGELOG explicitly states the server emits a sparse "limits crossed" map — only fields that have been exceeded are included. Accessing map["bandwidth"] on a dictionary where the key is absent throws KeyNotFoundException, not null. The existing null check (== null) only protects against an explicitly null value, not a missing key. When all limits are within bounds and the server returns an empty or partial object, deserialization will fail at runtime for every missing field.

* Added `Deno121`, `Deno124`, and `Deno135` runtime support to `BuildRuntime` and `Runtime` enums
* Added `SizeActual` property to `File` model for tracking actual file sizes
* Breaking: Changed `BillingLimits` properties to nullable types in constructor and model
* Breaking: Changed `BillingLimits` property to nullable in `Project` model
* Updated advisor authentication examples to use API key instead of session
@premtsd-code premtsd-code changed the title feat: .NET SDK update for version 4.0.1 feat: .NET SDK update for version 4.1.0 May 20, 2026

@ChiragAgg5k ChiragAgg5k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Auto-generated SDK updates consistent with the matching PRs in the other language SDKs (SizeActual on File, BillingLimits properties nullable, Deno121/124/135 added, advisor docs switched to API key auth, version + changelog bump). Breaking-change tags in the changelog match the reality of the nullable property changes.

@premtsd-code premtsd-code merged commit dc22cae into main May 20, 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.

2 participants