Skip to content

Support Notion-Version 2022-02-22 #276

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

Merged
merged 21 commits into from
Jul 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2219fc4
rename text property of blocks to rich_text
KoditkarVedant Jul 10, 2022
9f294d1
rename text to rich_text in updateblock models
KoditkarVedant Jul 10, 2022
5c2970d
Merge pull request #262 from notion-dotnet/242-rename-text-prop-to-ri…
KoditkarVedant Jul 10, 2022
5cb1c5d
Fix text filter properties and rename files
KoditkarVedant Jul 10, 2022
e85fbca
Merge pull request #263 from notion-dotnet/246-fix-text-property-filter
KoditkarVedant Jul 10, 2022
f9ddfff
add rollup property filter
KoditkarVedant Jul 10, 2022
4ecab19
fix breaking test cases ✅
KoditkarVedant Jul 10, 2022
433daa6
Merge pull request #264 from notion-dotnet/247-add-rollup-property-fi…
KoditkarVedant Jul 10, 2022
6d8a345
Rename Text prop to String in formula property filter
KoditkarVedant Jul 10, 2022
9985c00
Merge pull request #266 from notion-dotnet/248-formula-property-filte…
KoditkarVedant Jul 10, 2022
3c252dd
Add support for id, next_url & property_item prop
KoditkarVedant Jul 10, 2022
331819d
Merge pull request #269 from notion-dotnet/244-property_item-objects-…
KoditkarVedant Jul 13, 2022
f83606e
Removed list database endpoint
KoditkarVedant Jul 13, 2022
1172c4f
updated document 📝
KoditkarVedant Jul 13, 2022
f0b7ad2
Merge pull request #270 from notion-dotnet/245-remove-list-database-e…
KoditkarVedant Jul 13, 2022
f309683
Merge branch 'main' into notion-version-2022-02-22
KoditkarVedant Jul 16, 2022
c934d05
Merge branch 'notion-version-2022-02-22' of github.com:notion-dotnet/…
KoditkarVedant Jul 16, 2022
59f6d11
Set default Notion-Version to 2022-02-22
KoditkarVedant Jul 16, 2022
85a8a6f
Update readme to show default notion-version by NuGet package version 📝
KoditkarVedant Jul 16, 2022
01b5ed5
set version prefix to 3.0.0
KoditkarVedant Jul 16, 2022
c9d5103
Merge pull request #275 from notion-dotnet/241-update-default-notion-…
KoditkarVedant Jul 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ Provides the following packages:
dotnet add package Notion.Net
```

> Note: From Nuget 2.0.0 notion client sdk default sets the Notion-Version header to 2021-08-16.


> Note: default Notion-Version used by NuGet package versions
> | Package version | Notion-Version |
> | --- | --- |
> | 3.0.0+ | 2022-02-22 |
> | 2.0.0+ | 2021-08-16 |
> | 1.0.0+ | 2021-05-13 |

## Usage

Expand Down Expand Up @@ -113,7 +116,6 @@ var complexFiler = new CompoundFilter(
- [x] Create a database
- [x] Update database
- [x] Retrieve a database
- [x] List databases (Deprecated: use Search API instead)
- [x] Pages
- [x] Retrieve a page
- [x] Create a page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class BookmarkUpdateBlock : IUpdateBlock
public bool Archived { get; set; }

[JsonProperty("bookmark")]
public Data Bookmark { get; set; }
public Info Bookmark { get; set; }

public class Data
public class Info
{
[JsonProperty("url")]
public string Url { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public class BreadcrumbUpdateBlock : IUpdateBlock
public bool Archived { get; set; }

[JsonProperty("breadcrumb")]
public Data Breadcrumb { get; set; }
public Info Breadcrumb { get; set; }

public class Data
public class Info
{
}

public BreadcrumbUpdateBlock()
{
Breadcrumb = new Data();
Breadcrumb = new Info();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class BulletedListItemUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("bulleted_list_item")]
public TextContentUpdate BulletedListItem { get; set; }
public Info BulletedListItem { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class CalloutUpdateBlock : UpdateBlock, IUpdateBlock

public class Info
{
[JsonProperty("text")]
public IEnumerable<RichTextBaseInput> Text { get; set; }
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }

[JsonProperty("icon")]
public IPageIcon Icon { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class CodeUpdateBlock : UpdateBlock, IUpdateBlock

public class Info
{
[JsonProperty("text")]
public IEnumerable<RichTextBase> Text { get; set; }
[JsonProperty("rich_text")]
public IEnumerable<RichTextBase> RichText { get; set; }

[JsonProperty("language")]
public string Language { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public class DividerUpdateBlock : IUpdateBlock
public bool Archived { get; set; }

[JsonProperty("divider")]
public Data Divider { get; set; }
public Info Divider { get; set; }

public class Data
public class Info
{
}

public DividerUpdateBlock()
{
Divider = new Data();
Divider = new Info();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Notion.Client
public class EmbedUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("embed")]
public Data Embed { get; set; }
public Info Embed { get; set; }

public class Data
public class Info
{
[JsonProperty("url")]
public string Url { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Notion.Client
public class EquationUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("equation")]
public Data Equation { get; set; }
public Info Equation { get; set; }

public class Data
public class Info
{
[JsonProperty("expression")]
public string Expression { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class HeadingOneUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("heading_1")]
public TextContentUpdate Heading_1 { get; set; }
public Info Heading_1 { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class HeadingThreeeUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("heading_3")]
public TextContentUpdate Heading_3 { get; set; }
public Info Heading_3 { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class HeadingTwoUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("heading_2")]
public TextContentUpdate Heading_2 { get; set; }
public Info Heading_2 { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class NumberedListItemUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("numbered_list_item")]
public TextContentUpdate NumberedListItem { get; set; }
public Info NumberedListItem { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class ParagraphUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("paragraph")]
public TextContentUpdate Paragraph { get; set; }
public Info Paragraph { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class QuoteUpdateBlock : UpdateBlock, IUpdateBlock

public class Info
{
[JsonProperty("text")]
public IEnumerable<RichTextBaseInput> Text { get; set; }
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Notion.Client
public class SyncedBlockUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("synced_block")]
public Data SyncedBlock { get; set; }
public Info SyncedBlock { get; set; }

public class Data
public class Info
{
[JsonProperty("synced_from")]
public SyncedFromBlockId SyncedFrom { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ public class TableOfContentsUpdateBlock : IUpdateBlock
public bool Archived { get; set; }

[JsonProperty("table_of_contents")]
public Data TableOfContents { get; set; }
public Info TableOfContents { get; set; }

public class Data
public class Info
{
}

public TableOfContentsUpdateBlock()
{
TableOfContents = new Data();
TableOfContents = new Info();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace Notion.Client
public class TemplateUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("template")]
public Data Template { get; set; }
public Info Template { get; set; }

public class Data
public class Info
{
[JsonProperty("text")]
public IEnumerable<RichTextBaseInput> Text { get; set; }
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public class ToDoUpdateBlock : UpdateBlock, IUpdateBlock

public class Info
{
[JsonProperty("text")]
public IEnumerable<RichTextBaseInput> Text { get; set; }
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }

[JsonProperty("checked")]
public bool IsChecked { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public class ToggleUpdateBlock : UpdateBlock, IUpdateBlock
{
[JsonProperty("toggle")]
public TextContentUpdate Toggle { get; set; }
public Info Toggle { get; set; }

public class Info
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
}
18 changes: 1 addition & 17 deletions Src/Notion.Client/Api/Databases/DatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading.Tasks;
using static Notion.Client.ApiEndpoints;

namespace Notion.Client
Expand All @@ -19,20 +17,6 @@ public async Task<Database> RetrieveAsync(string databaseId)
return await _client.GetAsync<Database>(DatabasesApiUrls.Retrieve(databaseId));
}

[Obsolete("This endpoint is no longer recommended, use Search instead. This endpoint will only return explicitly shared pages, while search will also return child pages within explicitly shared pages. This endpoint's results cannot be filtered, while search can be used to match on page title.", false)]
public async Task<PaginatedList<Database>> ListAsync(DatabasesListParameters databasesListParameters = null)
{
var databasesListQueryParmaters = (IDatabasesListQueryParmaters)databasesListParameters;

var queryParams = new Dictionary<string, string>()
{
{ "start_cursor", databasesListQueryParmaters?.StartCursor },
{ "page_size", databasesListQueryParmaters?.PageSize?.ToString() }
};

return await _client.GetAsync<PaginatedList<Database>>(DatabasesApiUrls.List(), queryParams);
}

public async Task<PaginatedList<Page>> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters)
{
var body = (IDatabaseQueryBodyParameters)databasesQueryParameters;
Expand Down
11 changes: 1 addition & 10 deletions Src/Notion.Client/Api/Databases/IDatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;

namespace Notion.Client
{
Expand All @@ -8,14 +7,6 @@ public interface IDatabasesClient
Task<Database> RetrieveAsync(string databaseId);
Task<PaginatedList<Page>> QueryAsync(string databaseId, DatabasesQueryParameters databasesQueryParameters);

/// <summary>
/// List all Databases shared with the authenticated integration.
/// </summary>
/// <param name="databasesListParameters">database list request parameters.</param>
/// <returns>PaginatedList of databases.</returns>
[Obsolete("This endpoint is no longer recommended, use Search instead. This endpoint will only return explicitly shared pages, while search will also return child pages within explicitly shared pages. This endpoint's results cannot be filtered, while search can be used to match on page title.", false)]
Task<PaginatedList<Database>> ListAsync(DatabasesListParameters databasesListParameters = null);

/// <summary>
/// Creates a database as a subpage in the specified parent page, with the specified properties schema.
/// </summary>
Expand Down
Loading