Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
59d93d3
Introduce DataSources client
KoditkarVedant Oct 26, 2025
0f38db6
Add support to retrieve data source
KoditkarVedant Oct 26, 2025
3159205
Add missing description property in DataSourcePropertyConfigResponse …
KoditkarVedant Nov 1, 2025
bac7842
Add support for data source create api
KoditkarVedant Nov 1, 2025
7d9d895
Add integration test for data source create api
KoditkarVedant Nov 1, 2025
2463087
Refactor DualPropertyRelationDataRequest to use Data class for DualPr…
KoditkarVedant Nov 9, 2025
46f15aa
Add update functionality for data sources with corresponding request …
KoditkarVedant Nov 9, 2025
e5e7d6a
Add ListDataSourceTemplates api support
KoditkarVedant Nov 9, 2025
997080d
add support for query data sources api endpoint
KoditkarVedant Nov 30, 2025
1dc2743
Add filters for created by, created time, last edited by, last edited…
KoditkarVedant Nov 30, 2025
5cf7fea
Add support for creating databases with new request and response models
KoditkarVedant Nov 30, 2025
f57a27b
Delete obsolete database response JSON files to clean up test data
KoditkarVedant Nov 30, 2025
1d261bd
Remove obsolete database creation parameter classes and property schemas
KoditkarVedant Nov 30, 2025
81a742b
Enhance DateCustomConverter to handle timezone offsets and improve se…
KoditkarVedant Nov 30, 2025
1330cdd
Refactor PagesCreateParameters to use updated request models and clea…
KoditkarVedant Nov 30, 2025
b952a2f
Refactor LinkToPage handling to use new ILinkToPage interface and upd…
KoditkarVedant Nov 30, 2025
603d722
Add DataSourceParent class and update ParentType enum to include Data…
KoditkarVedant Nov 30, 2025
4292abf
Refactor parent input handling by removing obsolete classes and intro…
KoditkarVedant Nov 30, 2025
5fdde74
Refactor page parent handling in tests to use new PageParentRequest c…
KoditkarVedant Nov 30, 2025
7649622
Refactor Comments and Databases client tests to use PageParentRequest…
KoditkarVedant Nov 30, 2025
60948cf
Add support for updating databases with new request model and properties
KoditkarVedant Dec 6, 2025
8a9e85f
Update DataSource tests to use dynamically created database IDs
KoditkarVedant Dec 6, 2025
c34c82f
Add test for retrieving a database in DatabasesClientTests
KoditkarVedant Dec 6, 2025
8fae940
Remove QueryAsync method and related classes from DatabasesClient
KoditkarVedant Dec 6, 2025
6e1a940
Remove unused IWikiDatabase interface and update Database and Page cl…
KoditkarVedant Dec 6, 2025
abd6e60
Remove PagePropertyOnId class as it is no longer needed
KoditkarVedant Dec 6, 2025
1d51e8b
Enhance search functionality by adding support for data sources and u…
KoditkarVedant Dec 6, 2025
c0f9d74
Update target framework to net10.0 in integration and unit test projects
KoditkarVedant Dec 14, 2025
70cf81a
Refactor Comments API to use CreateCommentRequest and update related …
KoditkarVedant Dec 22, 2025
1e2ff8d
Rename file to RetrieveCommentsResponse
KoditkarVedant Dec 22, 2025
1b01dfc
Refactor parent type handling to use string constants and remove Pare…
KoditkarVedant Dec 22, 2025
5ceabac
Refactor block parent handling to use IParentOfBlock interface and up…
KoditkarVedant Dec 22, 2025
8976d7e
Refactor parent handling to use IParentOfPage interface across releva…
KoditkarVedant Dec 22, 2025
f3d1c86
Refactor Merger parents classes and remove legacy duplicate classes
KoditkarVedant Dec 22, 2025
38243b3
Refactor parent interfaces and types for data sources to improve cons…
KoditkarVedant Dec 22, 2025
92da395
Remove IParent interface and add type property ♻️
KoditkarVedant Dec 22, 2025
de1b792
Use IParentOfDatabase interface and remove IDatabaseParent interface ♻️
KoditkarVedant Dec 22, 2025
7b7f620
Refactor page icon response classes to use PageIconTypes for type con…
KoditkarVedant Dec 22, 2025
e3af460
Refactor page icon models for type consistency and clarity ♻️
KoditkarVedant Dec 22, 2025
5d465e8
Add cSpell configuration for custom words in settings
KoditkarVedant Dec 22, 2025
eb371b6
Remove IPageIcon interface from FileObject class
KoditkarVedant Dec 23, 2025
2b33e2a
Use IPageIconRequest interface for request model instead of IPageIcon
KoditkarVedant Dec 23, 2025
835573e
Refactor page cover models to use IPageCover interface for consistenc…
KoditkarVedant Dec 23, 2025
f8f861c
Add models for page cover requests: ExternalPageCoverRequest and File…
KoditkarVedant Dec 23, 2025
c29c813
Refactor Use IPageCoverRequest for create/update page cover request f…
KoditkarVedant Dec 23, 2025
5faf6a2
Rename DataSourceResponse to DataSource 🚚
KoditkarVedant Dec 23, 2025
9724397
Move DataSource and related response models in models folder 🚚
KoditkarVedant Dec 23, 2025
85e2982
Remove Response prefix from DataSourcePropertyConfig models 🚚
KoditkarVedant Dec 23, 2025
83ec389
Add DatabaseId property to DataSourceParentRequest model & Implement …
KoditkarVedant Dec 23, 2025
27c149b
Move IParentOfDataSourceRequest interface in common request models 🚚
KoditkarVedant Dec 23, 2025
8f9cac5
Rename PropertyConfigurationRequest to DataSourceConfigRequest and al…
KoditkarVedant Dec 23, 2025
89bf3fc
Move data source property config request objects under models/datasou…
KoditkarVedant Dec 23, 2025
6ce4fc2
Rename FileObjectResponse to FileUpload 🚚
KoditkarVedant Dec 23, 2025
caf6a1f
Move FileUpload models in common models folder 🚚
KoditkarVedant Dec 23, 2025
ea69ec7
Remove redundant IFileUploadsClient interface implementation from Fil…
KoditkarVedant Dec 23, 2025
5aee652
Refactor DataSourcesClient to return DataSource instead of redundant …
KoditkarVedant Dec 23, 2025
4300fc5
Refactor IFileUploadsClient to return FileUpload and remove redundant…
KoditkarVedant Dec 23, 2025
d841dfa
Remove unnecessary using directives across multiple files ⚰️
KoditkarVedant Dec 23, 2025
541eb4f
Remove linter warning to add cancellationToken parameter in xml docum…
KoditkarVedant Dec 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"Newtonsoft"
]
}
10 changes: 10 additions & 0 deletions Src/Notion.Client/Api/ApiEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,15 @@ public static class FileUploadsApiUrls
public static string List => "/v1/file_uploads";
public static string Retrieve(IRetrieveFileUploadPathParameters pathParameters) => $"/v1/file_uploads/{pathParameters.FileUploadId}";
}

public static class DataSourcesApiUrls
{
private const string BasePath = "/v1/data_sources";
public static string Retrieve(IRetrieveDataSourcePathParameters pathParameters) => $"{BasePath}/{pathParameters.DataSourceId}";
internal static string CreateDataSource() => BasePath;
internal static string Update(IUpdateDataSourcePathParameters pathParameters) => $"{BasePath}/{pathParameters.DataSourceId}";
internal static string ListDataSourceTemplates(IListDataSourceTemplatesPathParameters pathParameters) => $"/v1/data-sources/{pathParameters.DataSourceId}/templates";
internal static string Query(IQueryDataSourcePathParameters pathParameters) => $"{BasePath}/{pathParameters.DataSourceId}/query";
}
}
}
1 change: 0 additions & 1 deletion Src/Notion.Client/Api/Blocks/BlocksClient.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using static Notion.Client.ApiEndpoints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Info
public IEnumerable<RichTextBaseInput> RichText { get; set; }

[JsonProperty("icon")]
public IPageIcon Icon { get; set; }
public IPageIconRequest Icon { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ namespace Notion.Client
public class LinkToPageUpdateBlock : UpdateBlock
{
[JsonProperty("link_to_page")]
public IPageParentInput LinkToPage { get; set; }
public ILinkToPage LinkToPage { get; set; }
}
}
4 changes: 2 additions & 2 deletions Src/Notion.Client/Api/Comments/Create/CommentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace Notion.Client
{
public partial class CommentsClient
{
public async Task<CreateCommentResponse> CreateAsync(CreateCommentParameters parameters, CancellationToken cancellationToken = default)
public async Task<Comment> CreateAsync(CreateCommentRequest parameters, CancellationToken cancellationToken = default)
{
var body = (ICreateCommentsBodyParameters)parameters;

return await _client.PostAsync<CreateCommentResponse>(
return await _client.PostAsync<Comment>(
ApiEndpoints.CommentsApiUrls.Create(),
body,
cancellationToken: cancellationToken
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Collections.Generic;

namespace Notion.Client
{
public class CreateCommentRequest : ICreateDiscussionCommentBodyParameters, ICreatePageCommentBodyParameters
{
public string DiscussionId { get; set; }

public IEnumerable<RichTextBaseInput> RichText { get; set; }

public ParentPageInput Parent { get; set; }

public static CreateCommentRequest CreatePageComment(
ParentPageInput parent,
IEnumerable<RichTextBaseInput> richText)
{
return new CreateCommentRequest
{
Parent = parent,
RichText = richText
};
}

public static CreateCommentRequest CreateDiscussionComment(
string discussionId,
IEnumerable<RichTextBaseInput> richText)
{
return new CreateCommentRequest
{
DiscussionId = discussionId,
RichText = richText
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public interface ICreateCommentsBodyParameters
{
[JsonProperty("rich_text")]
public IEnumerable<RichTextBaseInput> RichText { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace Notion.Client
{
public interface ICreateDiscussionCommentBodyParameters : ICreateCommentsBodyParameters
{
[JsonProperty("discussion_id")]
public string DiscussionId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Newtonsoft.Json;

namespace Notion.Client
{
public interface ICreatePageCommentBodyParameters : ICreateCommentsBodyParameters
{
[JsonProperty("parent")]
public ParentPageInput Parent { get; set; }
}
}

This file was deleted.

4 changes: 2 additions & 2 deletions Src/Notion.Client/Api/Comments/ICommentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Notion.Client
{
public interface ICommentsClient
{
Task<CreateCommentResponse> CreateAsync(CreateCommentParameters createCommentParameters, CancellationToken cancellationToken = default);
Task<Comment> CreateAsync(CreateCommentRequest createCommentParameters, CancellationToken cancellationToken = default);

Task<RetrieveCommentsResponse> RetrieveAsync(RetrieveCommentsParameters parameters, CancellationToken cancellationToken = default);
Task<RetrieveCommentsResponse> RetrieveAsync(RetrieveCommentsRequest parameters, CancellationToken cancellationToken = default);
}
}
2 changes: 1 addition & 1 deletion Src/Notion.Client/Api/Comments/Retrieve/CommentsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Notion.Client
public partial class CommentsClient
{
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public async Task<RetrieveCommentsResponse> RetrieveAsync(RetrieveCommentsParameters parameters, CancellationToken cancellationToken = default)
public async Task<RetrieveCommentsResponse> RetrieveAsync(RetrieveCommentsRequest parameters, CancellationToken cancellationToken = default)
{
var qp = (IRetrieveCommentsQueryParameters)parameters;

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Notion.Client
{
public class RetrieveCommentsRequest : IRetrieveCommentsQueryParameters
{
public string BlockId { get; set; }

public string StartCursor { get; set; }

public int? PageSize { get; set; }
}
}
47 changes: 47 additions & 0 deletions Src/Notion.Client/Api/DataSources/Create/DataSourcesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Threading;
using System.Threading.Tasks;

namespace Notion.Client
{
public sealed partial class DataSourcesClient
{
public async Task<DataSource> CreateAsync(
CreateDataSourceRequest request,
CancellationToken cancellationToken = default)
{
var endpoint = ApiEndpoints.DataSourcesApiUrls.CreateDataSource();

if (request == null)
{
throw new ArgumentNullException(nameof(request));
}

ICreateDataSourceBodyParameters body = request;

if (body.Parent == null)
{
throw new ArgumentNullException(nameof(body.Parent), "Parent property cannot be null.");
}

if (body.Parent is DatabaseParentRequest dbParentRequest)
{
if (string.IsNullOrWhiteSpace(dbParentRequest.DatabaseId))
{
throw new ArgumentException("DatabaseId in Parent cannot be null or empty when Parent is of type DatabaseParentRequest.", nameof(request.Parent));
}
}

if (body.Properties == null)
{
throw new ArgumentException("Properties cannot be null or empty.", nameof(body.Properties));
}

return await _restClient.PostAsync<DataSource>(
endpoint,
body,
cancellationToken: cancellationToken
);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Generic;

namespace Notion.Client
{
public class CreateDataSourceRequest : ICreateDataSourceBodyParameters
{
public IParentOfDataSourceRequest Parent { get; set; }
public IDictionary<string, DataSourcePropertyConfigRequest> Properties { get; set; }
public IEnumerable<RichTextBaseInput> Title { get; set; }
public IPageIconRequest Icon { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Notion.Client
{
public interface ICreateDataSourceBodyParameters
{
[JsonProperty("parent")]
public IParentOfDataSourceRequest Parent { get; set; }

[JsonProperty("properties")]
public IDictionary<string, DataSourcePropertyConfigRequest> Properties { get; set; }

[JsonProperty("title")]
public IEnumerable<RichTextBaseInput> Title { get; set; }

[JsonProperty("icon")]
public IPageIconRequest Icon { get; set; }
}
}
12 changes: 12 additions & 0 deletions Src/Notion.Client/Api/DataSources/DataSourcesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Notion.Client
{
public sealed partial class DataSourcesClient : IDataSourcesClient
{
private readonly IRestClient _restClient;

public DataSourcesClient(IRestClient restClient)
{
_restClient = restClient;
}
}
}
Loading