8000 Adds support to read and write names for the file blocks. · Issue #412 · notion-dotnet/notion-sdk-net · GitHub
[go: up one dir, main page]

Skip to content
Adds support to read and write names for the file blocks. #412
Closed
@KoditkarVedant

Description

@KoditkarVedant

Description

Adds support to read and write names for the file blocks.

Now, when you retrieve a file block (uploaded or external file), the name of the file is included in the response.
For example:

"file": {
  "type": "external",
  "external": {
    "url": "https://example.com/my-file.pdf"
  },
  "caption": [],
  "name": "my-file.pdf"
}

Also, it supports setting a custom file name when adding a file block (external file only, since Notion API doesn't support uploading files).

var request = new BlockAppendChildrenRequest()
{
    BlockId = "xxx",
    After = "yyy",
    Children = new List<IBlockObjectRequest>()
    {
        new FileBlockRequest()
        {
            File = new ExternalFile()
            {
                External = new ExternalFile.Info()
                {
                    Url = "https://example.com/my-external-file.pdf"
                },
                Name = "my-custom-file-name.pdf"
            }
        }
    }
};

await _notionClient.Blocks.AppendChildrenAsync(request);

Documentation reference:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0