appwrite / sdk-for-dotnet

[READ-ONLY] Official Appwrite .NET SDK

Home Page:https://appwrite.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸš€ Feature: Auto Serialize payload when creating a document

nove1398 opened this issue Β· comments

πŸ”– Feature description

You should add auto serializing the data payload when creating Documents Database.CreateDocument(...). This will help minimize the work I need to do to create documents.

🎀 Pitch

In my use case, I tried to pass an object to the method as defined below:

var newProfile = Profile.Create(
	request.UserId,
	request.Car,
	request.Country,
	request.Duck,
	"AutoClose",
	request.DateOfBirth,
	request.LastTime
	);
Database.CreateDocument(
          collectionName,
          newProfile,
          [
          Permission.Read(Role.Users("verified")),
          Permission.Update(Role.User(request.UserId)),
          Permission.Delete(Role.User(request.UserId)),
          ]);

However it did not work, as Appwrite responded with an error stating Error: Invalid document structure: Missing attribute. I had to serialize the payload myself before it was accepted. In my request I am just asking for it to be auto serialized by the SDK before transmitting to Appwrite.

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏒 Have you read the Code of Conduct?