notion-dotnet / notion-sdk-net

A Notion SDK for .Net
MIT License
181 stars 44 forks source link

Why is the RichText property an IEnumerable? #385

Closed chinnuu05 closed 11 months ago

chinnuu05 commented 11 months ago

I'm trying to update a To-do block and I've done so successfully but I'm struggling to assign RichText an actual value and understand the code/why the RichText property is an IEnumerable?

ToDoUpdateBlock requestParams = new ToDoUpdateBlock()
{
    ToDo = new ToDoUpdateBlock.Info()
    {
        RichText = Enumerable.Empty<RichTextBaseInput>(),
        IsChecked = true
    }
};

NotionClient.Blocks.UpdateAsync(blockID, requestParams);

This code works but I don't understand how I'm supposed to use the RichText property. It's an IEnumerable but when I create a list of RichTextBaseInput like below I get an error from the API

ToDo = new ToDoUpdateBlock.Info()
{
    RichText = new List<RichTextBaseInput>() { new RichTextBaseInput()
    {
        PlainText = "shouldn't this work?"
    }},
    IsChecked = true
}

Thank you.