Skip to content
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

Why is the RichText property an IEnumerable? #385

Closed
chinnuu05 opened this issue Sep 21, 2023 · 0 comments
Closed

Why is the RichText property an IEnumerable? #385

chinnuu05 opened this issue Sep 21, 2023 · 0 comments

Comments

@chinnuu05
Copy link

chinnuu05 commented Sep 21, 2023

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.

@chinnuu05 chinnuu05 changed the title Why is the RichText property an IEnumerable? How am I supposed to implement this? Why is the RichText property an IEnumerable? Sep 21, 2023
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

No branches or pull requests

1 participant