Skip to content

Commit 3560745

Browse files
committed
✨ Adds RetrieveAsync to Pages client
1 parent 4c1d95d commit 3560745

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Src/Notion.Client/Api/ApiEndpoints.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static class BlocksApiUrls
2424
public static class PagesApiUrls
2525
{
2626
public static string Create() => $"/v1/pages";
27+
public static string Retrieve(string pageId) => $"/v1/pages/{pageId}";
2728
public static string UpdateProperties(string pageId) => $"/v1/pages/{pageId}";
2829
}
2930
}

Src/Notion.Client/Api/Pages/IPagesClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ namespace Notion.Client
66
public interface IPagesClient
77
{
88
Task<RetrievedPage> CreateAsync(CreatedPage page);
9+
Task<RetrievedPage> RetrieveAsync(string pageId);
10+
911
Task<RetrievedPage> UpdatePropertiesAsync(
1012
string pageId,
1113
IDictionary<string, PropertyValue> updatedProperties

Src/Notion.Client/Api/Pages/PagesClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public async Task<RetrievedPage> CreateAsync(CreatedPage page)
1818
return await _client.PostAsync<RetrievedPage>(PagesApiUrls.Create(), page);
1919
}
2020

21+
public async Task<RetrievedPage> RetrieveAsync(string pageId)
22+
{
23+
var url = PagesApiUrls.Retrieve(pageId);
24+
return await _client.GetAsync<RetrievedPage>(url);
25+
}
26+
2127
public async Task<RetrievedPage> UpdatePropertiesAsync(
2228
string pageId,
2329
IDictionary<string, PropertyValue> updatedProperties)

0 commit comments

Comments
 (0)