notion-sdk-net icon indicating copy to clipboard operation
notion-sdk-net copied to clipboard

Support notion version 2025-09-03

Open KoditkarVedant opened this issue 2 weeks ago • 2 comments

Description

WIP

Fixes #486

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] This change requires a documentation update

Checklist:

  • [x] My code follows the style guidelines of this project
  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules
  • [ ] I have checked my code and corrected any misspellings

KoditkarVedant avatar Dec 06 '25 20:12 KoditkarVedant

Curious why remove QueryAsync?

Thats one of the things I use, or was a better way of handling it added?

Also note you can mark outdated code as [Obselete] to mark it outdated but still have it working.

		/// <summary>
		/// This will create and set up the Id Lists for the passed in databaseId.
		/// </summary>
		/// <param name="client">The Notion Client.</param>
		/// <param name="databaseId">The notion database ID in which will be checked through.</param>
		/// This code is provided by Creator/Chaosyr/SaxbyMod/The Stoat Lord.
		public static async Task SetupIdLists(NotionClient client, string databaseId)
		{
			List<string> pageIds = new List<string>();
			string? nextCursor = null;

			do
			{
				var queryParams = new DatabasesQueryParameters
				{
					StartCursor = nextCursor,
					PageSize = 100
				};
				var response = await RetryWithBackoffClass.RetryWithBackoff(() => client.Databases.QueryAsync(databaseId, queryParams));
				Logging.Log("SetupIdLists", "Info", $"Received {response.Results.Count} results for database {databaseId}");
				pageIds.AddRange(response.Results.Select(page => page.Id));
				nextCursor = response.HasMore ? response.NextCursor : null;
			} while (!string.IsNullOrEmpty(nextCursor));
			
			StartingPoint.IdLists.Add($"Key_{databaseId}", pageIds);

Chaosyr avatar Dec 11 '25 10:12 Chaosyr

Curious why remove QueryAsync?

Thats one of the things I use, or was a better way of handling it added?

Also note you can mark outdated code as [Obselete] to mark it outdated but still have it working.

		/// <summary>
		/// This will create and set up the Id Lists for the passed in databaseId.
		/// </summary>
		/// <param name="client">The Notion Client.</param>
		/// <param name="databaseId">The notion database ID in which will be checked through.</param>
		/// This code is provided by Creator/Chaosyr/SaxbyMod/The Stoat Lord.
		public static async Task SetupIdLists(NotionClient client, string databaseId)
		{
			List<string> pageIds = new List<string>();
			string? nextCursor = null;

			do
			{
				var queryParams = new DatabasesQueryParameters
				{
					StartCursor = nextCursor,
					PageSize = 100
				};
				var response = await RetryWithBackoffClass.RetryWithBackoff(() => client.Databases.QueryAsync(databaseId, queryParams));
				Logging.Log("SetupIdLists", "Info", $"Received {response.Results.Count} results for database {databaseId}");
				pageIds.AddRange(response.Results.Select(page => page.Id));
				nextCursor = response.HasMore ? response.NextCursor : null;
			} while (!string.IsNullOrEmpty(nextCursor));
			
			StartingPoint.IdLists.Add($"Key_{databaseId}", pageIds);

@Chaosyr That API is deprecated as of notion version 2025-09-03, Notion introduce this as a breaking change, therefore, It is not guarantee to work hence library won't be able to support both versions at time.

For your case you can instead use the Query API on DataSource https://developers.notion.com/reference/retrieve-a-data-source. This should return the expected data, you need to additionally pass the DataSourceId

KoditkarVedant avatar Dec 14 '25 09:12 KoditkarVedant