-
Notifications
You must be signed in to change notification settings - Fork 20
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
🚀 Feature: Proposal for Building a separate API SDK - "Appwrite.Core" for Modern .NET Version (6+ onwards) Using Refit, System.Text, and HttpClientFactory #25
Comments
Thanks for raising this discussion @initinll I do have my reservations here for a few reasons:
Additionally, the primary comment on the top refers to making the SDK compatible for modern .NET versions and beyond. Projects targeting .NET Standard 2.0 anyway are compatible across .NET Framework, .NET Core, and modern .NET projects. |
I will agree that there are benefits of using System.Text.Json for serialisation and deserialisation over Newtonsoft.Json. @abnegate I would love to double check if there are any specific reasons why we prefer Newtonsoft.Json (aside from simplicity)? |
I agree with @adityaoberai on all points. No reason not to use |
@initinll while we explore options to improve performance and developer experience, if you would like to create and maintain your own version of the SDK, please feel free to do so :D We do appreciate community-maintained libraries and SDKs and if you would like to develop, that's absolutely alright too! |
🔖 Feature description
The proposed feature involves building a separate API SDK - "Appwrite.Core" based on the existing API SDK to make it compatible with modern .NET versions (specifically .NET 6 and beyond). The new approach will utilize the Refit library, System.Text, and HttpClientFactory to optimize the SDK's performance, simplify the development process, and provide a seamless integration experience for developers.
🎤 Pitch
Why Implement this Feature:
Upgrading the API SDK for modern .NET versions is essential to keep up with the latest advancements and ensure that our SDK remains relevant and efficient. By rebuilding the SDK using Refit, System.Text, and HttpClientFactory, we can leverage their capabilities to enhance the overall development experience and the quality of our SDK.
Advantages of the Proposed Approach:
a) Refit Integration:
Refit is a powerful library that simplifies the creation of type-safe API clients. By utilizing Refit, we can eliminate the need for writing boilerplate code to handle HTTP requests and responses. Instead, developers can define API interfaces with attributes, making the SDK more concise and expressive. This will improve the readability and maintainability of the codebase.
Example of using Refit:
b) System.Text for JSON Serialization:
.NET 6 includes significant improvements in System.Text.Json for JSON serialization and deserialization. By adopting System.Text.Json as the default JSON serializer for the SDK, we can benefit from its superior performance and reduced memory allocation compared to third-party libraries. This will lead to faster data processing and a more efficient SDK.
c) HttpClientFactory Integration:
The HttpClientFactory is designed to manage HttpClient instances efficiently, minimizing the overhead of creating new connections for each API request. By integrating HttpClientFactory, we can improve the SDK's performance and mitigate potential issues related to HttpClient misuse, such as socket exhaustion and connection leaks.
Example Implementation details
Get Account
The SDK will automatically handle the HTTP request and response, making the integration process intuitive and efficient.
Example Client invocation:
🚧 For more implementation details checkout - https://github.com/initinll-forks/sdk-for-dotnet/tree/dotnet-6
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: