Skip to content

Conversation

@KoditkarVedant
Copy link
Contributor

Description

WIP

Fixes #486

Type of change

Please delete options that are not relevant.

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

Checklist:

  • 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

…and response models

- Add unit and integration tests
…ducing new request models for page and database parents
@Chaosyr
Copy link

Chaosyr commented Dec 11, 2025

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);

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

Successfully merging this pull request may close these issues.

API Version 2025-09-03

3 participants